When you run
sails lift with blueprints enabled, the framework inspects your controllers, models, and configuration in order to bind certain routes automatically. These implicit blueprint routes (sometimes called "shadow routes", or even just "shadows") allow your app to respond to certain requests without you having to bind those routes manually in your
config/routes.js file. By default, the blueprint routes point to their corresponding blueprint actions (see "Blueprint Actions" below), any of which can be overridden with custom code.
There are three types of blueprint routes in Sails:
/:modelIdentity/:id. These routes use the HTTP "verb" to determine the action to take; for example a
/userwill create a new user, and a
/user/123will delete the user whose primary key is 123. In a production environment, RESTful routes should generally be protected by policies to avoid unauthorized access.
/user/create?name=joeshortcut creates a new user, while
/user/update/1?name=mikeupdates user #1. These routes only respond to
GETrequests. Shortcut routes are very handy for development, but generally should be disabled in a production environment.
FooController.jsfile with a
barmethod, then a
/foo/barroute will automatically be created for you as long as blueprint action routes are enabled. Unlike RESTful and shortcut routes, action routes do not require that a controller has a corresponding model file.
See the blueprints subsection of the configuration reference for blueprint configuration options, including how to enable / disable different blueprint route types.