Friday 17 March 2017

Hook after and before-request to /Odata/Model with loopback

I set up the loopback landscape. It provides odata 2.0 service which is working well. But I need to hook the before and after requests to the service. In the docu there is an example like: `

Model.afterRemote('**', function (ctx, user, next) {
        logger.info(ctx.methodString, 'was invoked remotely')
          if(ctx.result) {
            if(Array.isArray(ctx.result)) {
              ctx.result.forEach(function (result) {
              });
            } else {
            }
          }

          next();
        });

`

But the problem is, that it is only hooking the requests of ../api/Model and not of ../odata/Model. How can I hook the odata-requests? Also it has still to return odata-objects.

Thanks in advance.



via AngularLover

No comments:

Post a Comment