node.js - Beforeremote for all api calls loopback -
is possible write common beforeremote hook api calls in loopback. able write beforeremote hook api's in particular model through models object like:
modelobj.beforeremote('*', function (ctx, req, next) { //code next() });
likewise possible write 1 before remote api calls. appreciated! thankyou!
i got answer , posting here use in same situation. in boot script file, use following code:
module.exports = function(app) { var remotes = app.remotes(); remotes.before('**', function (ctx, next) { //code execute before api calls goes here next(); }); };
thats it!!!!
Comments
Post a Comment