leejt489
leejt489

Reputation: 615

Sails.js: Enable some (but not all) REST blueprint routes?

In Sails.js v0.10, I can set whether or not to expose REST routes for controllers by setting the rest property in config\blueprints.js or by setting _config: { rest: true } //or false in the controller definition.

Does anyone know if it's possible (and how) to set this for some REST routes but not all?

For example, something like rest: { find: true, create: true, destroy: false, update: false }

I realize there are workarounds, but it would be nice to be able to set the defaults in one line.

Upvotes: 2

Views: 1067

Answers (2)

ali-pourzahmatkesh
ali-pourzahmatkesh

Reputation: 113

you can duplicate the default blueprint api and remove unwanted js files and in your routing bind the routes to the specific custom blueprint you made. it will work

Upvotes: -1

hbinduni
hbinduni

Reputation: 1250

you can use policy setting like below. this will allow find but disable the other method.

'Foo': {
    '*': false,
    'find': 'sessionAuth'
}

Upvotes: 4

Related Questions