我怎样才能让所有的远程方法和终点/模型的回送3的属性?

问题描述 投票:0回答:1

我试图找出模型的所有远程方法和它的终点/属性?我怎样才能得到它在环回3?

loopbackjs
1个回答
1
投票

还有在GitHub上类似的讨论:

以下是他们建议使用来获得所有特定模型中的远程方法的代码:

function getActiveRemoteMethods(model) {
  const activeRemoteMethods = model.sharedClass
    .methods({ includeDisabled: false })
    .reduce((result, sharedMethod) => {
      Object.assign(result, {
        [sharedMethod.name]: sharedMethod.isStatic,
      });
      return result;
    }, {});

  return activeRemoteMethods;
}
© www.soinside.com 2019 - 2024. All rights reserved.