View our GitHub

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

Edit Page

sails.config.routes

Configuration for custom (aka "explicit") routes. sails.config.routes consists of a single Javascript object whose keys are URL paths (the "address") and whose values are one of several types of route handler configurations (the "target"), for example:

module.exports.routes = {

    "GET /": {view: "homepage"},
    "POST /foo/bar": {controller: "FooController", action: "bar"}

}

Please see the routes concept overview for a full discussion of Sails routes, and the custom routes documentation for a detailed description of the available configurations for both the route address and target.

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.

Reference

We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book