我有一个用户模型和一个追随者模型,它与追随者和被追随者的用户具有 HasManyThrough 关系。 如何更改默认的 __get__followers 方法参数?
最佳答案
我发现我可以用正常的方式添加一个新的远程方法。
loopback.remoteMethod(
UserModel.prototype.getFollows,
{
description: 'Get the users who are followed by the user',
accepts: [
{arg: 'page', type: 'Number', http: {source: 'query'}, required: true}
],
returns: {arg: 'data', type: 'object'},
http: {verb: 'get', path: '/follows'},
isStatic: false,
}
);
关于node.js - 在 Strongloop 环回中重写关系远程方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27080932/