CRUD blueprint overriding in sails.js

Update

In order to override blueprints in Sails 1.0 in the manner described below, you must first install the “custom blueprints” plugin for your project (npm install sails-hook-custom-blueprints).


To override blueprints in Sails v0.10, you create an api/blueprints folder and add your blueprint files (e.g. find.js, create.js, etc.) within. You can take a look at the code for the default actions in the Sails blueprints hook for a head start.

Adding custom blueprints is also supported, but they currently do not get bound to routes automatically. If you create a /blueprints/foo.js file, you can bind a route to it in your /config/routes.js file with (for example):

'GET /myRoute': {blueprint: 'foo'}

Leave a Comment