2017-07-17 42 views
0

我想定义一个远程方法具有以下路径:回送远程方法路径定义问题

http://localhost:3000/api/dataSourceTestings/(编号)/一个

In the dataSourceTesting.json file I defined its path as : 
"http": [ 
     { 
      "path": "/{id}/a", 
      "verb": "put" 
     }, 
] 

But when I send request on this end point it gives me the error that can't found the method for this endpoint. 

我需要为它定义或关系是存在的任何其他方式来定义此路径的远程方法?

回答

0

你应该dataSourceTesting.js文件定义remotemethod:

DataSourceTesting.remoteMethod('putDataSourceTestings', { 
    accepts: [ 
     {arg: 'id', type: 'string'}], 
    http: {path:'/:id/a', verb:'put'}, 
    returns: {arg: 'result', type: 'json'} 
}); 

然后实现你的putDataSourceTestings功能:

DataSourceTesting.putDataSourceTestings = function(id, cb){ 
    //your logic goes here 
} 
+0

非常非常感谢你 :) – irti