2017-07-17 4 views
0

私は次のパスを使用してリモートメソッドを定義したい:ループバックリモートメソッドパス定義の問題

http://localhost:3000/api/dataSourceTestings/ {ID}/

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

関連する問題