Search code examples
node.jsstrongloop

Hiding a method for a related model


How can I hide a method for a related model?

Let's say that, in the demo app loopback-example-datagraph, I don't want to expose the DELETE /customers/{id}/orders method.

How should I go about this?


Solution

  • For loopback 1.x, the relation is mapped to a prototype method internally. To not expose it as REST APIs, try the following:

    var customer = app.models.Customer;
    customer.prototype.__delete_orders.shared = false;