This most probably indicates that your api is not being set properly. Check whether the api file ahas module.exported , you properly express.Router and returning it. In my case I forgot to return the api, and got the error.
module.exports = function(app, express) {
var api = express.Router();
/////////////////////////////////////////////////////////////
api.get("/users", function(req, res) {
User.find({} , function(err, users) {
if (err)
{
res.send(err);
}
else
{
res.json(users);
}
});
} );
/////////////////////////////////////////////////////////////
return api; //<= forgot this!
}
No comments:
Post a Comment