2017-07-17 1 views
0

ich eine Remote-Methode mit dem folgenden Pfad definieren möchten:Loopback-Remote-Methode Pfaddefinition Ausgabe

http://localhost:3000/api/dataSourceTestings/ {id}/a

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. 

Benötige ich eine Beziehung für sie zu definieren, oder gibt es eine andere Möglichkeit, eine Remote-Methode für diesen Pfad zu definieren?

Antwort

0

sollten Sie Ihre remotemethod in dataSourceTesting.js Datei definieren:

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

dann putDataSourceTestings Funktion implementieren:

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

Vielen vielen Dank :) – irti