Definition of static remote methods and their method signatures in Loopback

From the loopback documentation it states that:

Both beforeRemote() and afterRemote() have the same signature; below syntax uses beforeRemote but afterRemote is the same. For static remote methods, including custom remote methods:

modelName.beforeRemote( methodName, function(ctx, next) { ...
   next(); 
});

The documentation then goes on to say ...

Static methods have URL /api/modelName/methodName, while prototype methods have URL /api/mod elName/id/methodName.

Elsewhere, an example is provided

module.exports = function(Review) {
  Review.beforeRemote('create', function(context, user, next) {
    var req = context.req;
    req.body.date = Date.now();
    req.body.publisherId = req.accessToken.userId;
    next();
}); };

Based on the above documentation ... I would expect that create would be a static method and therefore only have two arguments (but yet in this example above, and in practice, beforeRemote for create has three arguments.

Is there a different definition or a list of a static methods available?

Answers


I think this is an error in the documentation, since PersistedModel.create is a static method.

A list of static and instance methods is in the reference docs:

https://apidocs.strongloop.com/loopback/v/2.27.0/#persistedmodel


Need Your Help

Mac OS X 10.9 - setting permanent environment variables

macos bash environment-variables osx-mavericks

How do I set a permanent environment variable (i.e. one that does not need exporting every time I start a new Terminal session) in Mac OS X 10.9? I've found a number of answers about modifying my .