Routes are rules that tell Sails what to do when faced with an incoming request.
Routes are defined in
config/routes.js. The order of the routes is significant, as routes are matched top down. This means if you have a specific route that also could be matched by a wildcard route, the specific route should be defined above the wildcard route.
When a request enters your application sails.js grabs all the parameters that came with it and makes them available for you as
params on the request object.
Properties in the route target object will be passed through to the route handler in the req.options object. The following are reserved properties that can affect the behavior of the route handler:
|Property||Applicable Target Types||Data Type||Details|
|skipAssets||all||Boolean||Set to |
|skipRegex||all||Regexp||If skipping every URL containing a dot is too permissive, or you need a route's handler to be skipped based on different criteria entirely, you can use |
|locals||controller, view, blueprint, response||Dictionary||Sets default local variables to pass to any view that is rendered while handling the request.|
|cors||all||Dictionary or Boolean or String||Specifies how to handle requests for this route from a different origin.|
|populate||blueprint||Boolean||Indicates whether the results in a "find" or "findOne" blueprint action should have associated model fields populated. Defaults to the value set in |
|skip, limit, sort, where||blueprint||Dictionary||Set criteria for "find" blueprint.|