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:

PropertyApplicable Target TypesData TypeDetails
skipAssetsallBooleanSet to true if you don't want the route to match URLs with dots in them (e.g. myImage.jpg). This will keep your routes with wildcard notation from matching URLs of static assets. Useful when creating URL slugs.
skipRegexallRegexpIf 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 skipRegex. This option allows you to specify a regular expression or array of regular expressions to match the request URL against; if any of the matches are successful, the handler is skipped. Note that unlike the syntax for binding a handler with a regular expression, skipRegex expects _actual RegExp objects, not strings.
localscontroller, view, blueprint, responseDictionarySets default local variables to pass to any view that is rendered while handling the request.
corsallDictionary or Boolean or StringSpecifies how to handle requests for this route from a different origin.
populateblueprintBooleanIndicates whether the results in a "find" or "findOne" blueprint action should have associated model fields populated. Defaults to the value set in config/blueprints.js.
skip, limit, sort, whereblueprintDictionarySet criteria for "find" blueprint.