kYuZz
kYuZz

Reputation: 1732

How to hide REST API methods in LoopBack 2.0?

I haven't managed to hide API methods in LoopBack 2.0.

According to the documentation, I should achieve this with something like:

var app = require('../app');
var Location = app.models.Location;
Location.deleteById.shared = false;

Howver, this doesn't seem to work.

Also, console.log(Location.deleteById) prints:

[Function]

If deleteById is a function and not an object, then the assignment to the shared property makes no sense. No surprise then, that console.log(Location.deleteById.shared) prints:

undefined

Any clues, anybody?

Upvotes: 1

Views: 2596

Answers (1)

Shubham Patlani
Shubham Patlani

Reputation: 31

You should see the new documentation,

http://docs.strongloop.com/display/public/LB/Exposing+models+over+REST#ExposingmodelsoverREST-HidingmethodsandRESTendpoints

this works for me,

MyModel.disableRemoteMethod('deleteById', true);

Upvotes: 2

Related Questions