【发布时间】:2016-01-25 02:02:17
【问题描述】:
我尝试覆盖 strongloop 休息端点的 find api。我想返回一个对象数组。但是如何指定对象的架构?从上图中可以看出,模型架构是空的。
下面是我公司模型remoteMethod的代码:
Company.remoteMethod(
'find',
{
accepts: {arg: 'msg', type: 'string'},
returns: {type: 'array', root: true},
http: {path: '/', verb:'get'}
}
)
【问题讨论】:
-
您是否创建了
company模型?如果是这样,配置是什么?该配置定义了您的架构...查看documentation for how to create models。 -
@jakerella:是的,我创建了一个公司模型。但是我想通过远程方法覆盖api /companies {GET},并且已经可以实现。我的问题是,在 api explorer 中,Model Schema 是 [{}],它没有显示对象的属性。
-
啊啊,我明白了……我不知道该怎么做。
标签: loopbackjs strongloop