我想用以下路径定义远程方法:
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.
我是否需要为其定义关系,还是有其他方法为此路径定义远程方法?
答案 0 :(得分: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
}
答案 1 :(得分:0)