title: Can't get users using restful API with node and mongodb
body: <p>When I set up the route for users in server.js and test with postman/localhost I get the error message, cannot GET /users.  Same with any other crud operation.  How can I fix this route?  </p>
  
  <p>server.js</p>
  
  <pre><code>    var express     =   require("express");
      var app         =   express();
      var bodyParser  =   require("body-parser");
      var router      =   express.Router();
      var mongoOp     =   require("./models/mongo");
  
      app.use(bodyParser.json());
      app.use(bodyParser.urlencoded({"extended" : false}));
  
      router.get("/",function(req,res){
         res.json({"error" : false,"message" : "Hello World"});
      });
  
      router.route("/users")
          .get(function(req,res){
      var response = {};
      mongoOp.find({},function(err,data){
      // Mongo command to fetch all data from collection.
          if(err) {
              response = {"error" : true,"message" : "Error fetching data"};
          } else {
              response = {"error" : false,"message" : data};
          }
          res.json(response);
      });
  });
  
      app.use('/',router);
  
      app.listen(3000);
      console.log("Listening to PORT 3000");
  </code></pre>
  
  <p>mongo.js</p>
  
  <pre><code>    var mongoose    =   require("mongoose");
      mongoose.connect('mongodb://localhost:27017/meanapi');
  
      var mongoSchema =   mongoose.Schema;
  
      var userSchema = {
          "userEmail" : String,
          "userPassword" : String
       };
  
       module.exports = mongoose.model('userLogin', userSchema);
  </code></pre>