View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page


By default, Sails controllers automatically bind routes for each of their functions. Additionally, each controller will automatically bind routes for a CRUD API controlling the model which matches its name, if one exists.


Property Type Default Details
actions true Whether routes are automatically generated for every action in your controllers (also maps index to /:controller) '/:controller', '/:controller/index', and '/:controller/:action'
rest true Automatic REST blueprints enabled? e.g. 'get /:controller/:id?' 'post /:controller' 'put /:controller/:id' 'delete /:controller/:id'
shortcuts true These CRUD shortcuts exist for your convenience during development, but you'll want to disable them in production.: '/:controller/find/:id?', '/:controller/create', '/:controller/update/:id', and '/:controller/destroy/:id'
prefix '' Optional mount path prefix for blueprints (the automatically bound routes in your controllers) e.g. '/api/v2'
restPrefix '' Optional mount path prefix for RESTful blueprints (the automatically bound RESTful routes for your controllers and models) e.g. '/api/v2'. Will be joined to your prefix config. e.g. prefix: '/api' and restPrefix: '/rest', RESTful actions will be available under /api/rest
pluralize false Optionally use plural controller names in blueprint routes, e.g. /users for api/controllers/UserController.js.
populate true Whether the blueprint controllers should populate model fetches with data from other models which are linked by associations. If you have a lot of data in one-to-many associations, leaving this on may result in very heavy api calls.
defaultLimit 30 The default number of records to show in the response from a "find" action. Doubles as the default size of populated arrays if populate is true.
autoWatch true Whether to run in the find and findOne blueprint actions. Can be overridden on a per-model basis.
jsonp false Optionally wrap blueprint JSON responses in a JSONP callback using res.jsonp() from Express 3.

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.


We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book