1

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?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
kYuZz
  • 1,572
  • 4
  • 14
  • 25

1 Answers1

2

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);
  • Just to point namely to description of several ways of method disabling - [Hiding methods and REST endpoints](http://loopback.io/doc/en/lb2/Exposing-models-over-REST.html#hiding-methods-and-rest-endpoints) – Serg Aug 14 '17 at 12:26