sails.js - Sails - Overriding default routes in routes.js -
wondering why not working
// routes.js 'get /user/me' : { controller : 'user', action : 'me' }, 'get /user/:id' : { controller : 'user', action : 'findone' } // usercontroller.js module.exports = { me: function(req, res, next) { // code here }, findone: function(req, res, next) { // code here }; }
http call "/user/me" never hits usercontroller.me usercontroller.findone.
update
problem api restprefix defined in blueprints.js
restprefix: '/api',
so routes should be
'get /api/user/me': { controller: 'user', action: 'me' }, 'get /api/user/:id': { controller: 'user', action: 'findone' }
Comments
Post a Comment