2017-07-17 44 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