Reputation: 380
If I have a url that's generated from a relationship /threads/{id}/messages
how could I write a afterRemote
hook that will execute after this query is finished?
Upvotes: 0
Views: 53
Reputation: 1205
As per stated here by one of the maintainers of Loopback, you can use the followings to write remote hooks.
POST
/threads/{id}/messagesthread.beforeRemote('*.__create__messages__', function(ctx, inst, next) { ... });
GET
threads/{id}/messagesthread.beforeRemote('*.__get__messages__', function(ctx, inst, next) { ... });
DELETE
threads/{id}/messagesthread.beforeRemote('*.__delete__messages__', function(ctx, inst, next) { ... });
Upvotes: 1