Skip to content

Inconsistent API for remote methods and hooks #597

Description

@bajtos

As of LoopBack 2.0, there is a new method for defining remote method metadata Model.remoteMethod. To configure a prototype method, one has to supply a flag isStatic:

Model.remoteMethod('foo', { isStatic: false, ... });

A) This is inconsistent with the approach we have already in place for hooks (docs), where we prefix the method name with prototype.:

Model.beforeRemote('prototype.foo', ...);

B) The usage of this API - e.g. ('find', true) - is very ambiguous. What does true mean? One has to be very familiar with the API to understand what is the intent of such code snippet.


We should modify Model.remoteMethod to support the prototype.foo notation too.

Since both Model.remoteMethod and Model.beforeRemote are thin wrappers around strong-remoting API, we should fix this problem in strong-remoting too.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions