如何在环回 3 中获取模型的所有远程方法和 end-point/properties?

How can I get all the remote method and end-point/properties of a model in loopback 3?

我想找出模型的所有远程方法及其 end-point/properties?我怎样才能在环回 3 中得到它?

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;
}