0
少し厄介かもしれませんが、私は理解できないほど馬鹿です。すべてdocumentationと例は、リモートメソッドを記述する方法を示していますが、複数ではありません。私の場合、私はすでに遠隔メソッドとそれを完璧に記述しています。 モデルに複数のリモートメソッドを書き込む方法は?
module.exports = function(customer) {
customer.signup = function(data, cb) {
customer.create(data, function(err, response){
cb(err, response);
});
};
customer.remoteMethod(
'signup',
{
accepts: [{arg: 'data', type: 'object', http: { source: 'body' }}],
returns: {type: 'object', root: true}
}
);
};
私は別のリモートメソッドを追加しよう
、その必要に応じて、いくつかの構文エラーが原因である可能性が働いていません。module.exports = function(customer) {
customer.signup = function(data, cb) {
customer.create(data, function(err, response){
cb(err, response);
});
};
customer.remoteMethod(
'signup',
{
accepts: [{arg: 'data', type: 'object', http: { source: 'body' }}],
returns: {type: 'object', root: true}
}
);
customer.resetPassword = function (data, cb) {
console.log(data);
cb(null, data);
};
customer.remoteMethod(
'resetPassword',
{
accepts: [{arg: 'data', type: 'object', http: { source: 'body' }}],
returns: {type: 'object', root: true}
}
);
};
アレイなどでremoteMethods宣言をマージするように私もいくつかのバリエーションを試みたが、どれも動作しないであろう。私が正しくないところをお勧めします。