Search code examples
loopbackjsstrongloop

Loopback afterRemote of __get__identities not executed


I have a user model which hasMany userIdentity, the relationship name is 'identities'.

I defined the following in user model. However, when I can GET /users/me/identities, it returns me the correct resource, but the afterRemote never get executed.

User.afterRemote('__get__identities', function (context, identities, next) {
   console.log('after __get__identities');
   next();
})

Solution

  • You can use 'prototype.__get__identities' to match the remote name if you like but as @IvanSchwarz has suggested, using '*.__get__identities' will also work.