2016-03-18 18 views
0

從回送文件的方法簽名,它指出:定義和環回

兩個beforeRemote()和afterRemote()具有相同的簽名; 語法使用beforeRemote,但afterRemote是相同的。對於靜態 遠程方法,包括自定義遠程方法:

modelName.beforeRemote(methodName, function(ctx, next) { ... 
    next(); 
}); 

的文檔,然後接着說...

靜態方法有URL/API/MODELNAME /方法名,而原型 方法有URL/api/mod elName/id/methodName。

在其他地方,一個例子是提供

module.exports = function(Review) { 
    Review.beforeRemote('create', function(context, user, next) { 
    var req = context.req; 
    req.body.date = Date.now(); 
    req.body.publisherId = req.accessToken.userId; 
    next(); 
}); }; 

根據上述文件上...我預計create將是一個靜態方法,因此只有兩個參數(但尚未在上面這個例子中,並在實踐中,爲beforeRemotecreate三個參數。

是否有不同的定義或可用的靜態方法列表?

回答