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?
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?
对于环回 1.x,关系在内部映射到原型方法。要不将其公开为 REST API,请尝试以下操作:
var customer = app.models.Customer;
customer.prototype.__delete_orders.shared = false;
免责声明我从未使用过 StrongLoop
野刺,但看起来这可能会奏效。当您添加关系时,它会向底层模型类添加一个方法。当您添加一个有很多时,它会添加此方法
customer.orders.destroyAll(function(err) {
...
});
你应该可以说类似
var customer = app.models.Customer;
customer.orders.destroyAll.shared = false;