【发布时间】:2016-01-05 23:48:48
【问题描述】:
您好,我是 strongloop 的新手,我想知道我可以在自定义模型中编写我的应用程序逻辑吗?就像下面的例子一样,我从订单表中获取数据,成功后我想在我的逻辑中使用它的响应。
Orders.createOrder = function(cb) {
Orders.findById( userId, function (err, instance) {
response = "Name of coffee shop is " + instance.name;
cb(null, response);
/***** want to write my logic here *****/
console.log(response);
});
cb(null, response);
};
Orders.remoteMethod(
'createOrder',
{
http: {path: '/createOrder', verb: 'get'},
returns: {arg: 'status', type: 'string'}
}
);
那么它是写的地方还是我必须在其他地方写呢?
【问题讨论】:
标签: strongloop