In Sails.js , CRUD and REST design routes are included for development, but for production, I suggest you have your own actions that can find / create / update / delete models in this controller
Sails automatically map the actions in your controllers to the corresponding routes, without having to manually configure them to disable this: set the action flag to false in the file config / controllers.js / p>
This is best explained with an example, so here is a basic model with multiple RESTful routes
models /user.js
Our model has two attributes and does not provide uniqueness.
module.exports = { attributes: { name: 'string', email: 'string' } };
Controllers /UserController.js
Our controller has two actions: findAll returns all users, and findByName returns users with the given name
module.exports = { findAll: function (req, res) { User.find().done(function (err, users) { if (err) { res.send(400); } else { res.send(users); } }); }, findByName: function(req, res) { var name = req.param('name'); User.findByName(name).done(function (err, users) { if (err) { res.send(400); } else { res.send(users); } }); } };
configurations /routes.js
The configuration of our routes has two routes that respond only to GET requests, / user / all will trigger the findAll action, and name / username / name /: the findByName action will be launched with the name specified as a parameter in the URL
module.exports.routes = { 'GET /user/all': 'UserController.findAll', 'GET /user/name/:name': 'UserController.findByName' };
For more information, be sure to check the controller documentation in Sails.js