未來我有一個問題,使這個URL路徑:快速路由使用參數過濾器從emberJs
http://localhost:3000/api/tests?filter%5Bcodeid%5D=eeee
在我想這一刻:
在服務器
app.route('/api/tests?filter[codeid]=:param')
.get((req, res) => {
console.log('It works');
res.status(200).send({
msg: 'It works'
});
});
在前面
this.store.query('test', { filter: { codeid: code } })
.then(test => {
if(test.get('firstObject')){
console.log(test.get('firstObject').get('id'));
console.log('exist');
}
})
.catch(err => {
console.log(err);
});
但是當我測試服務器郵遞員我有這樣的結果:
Cannot GET /api/tests?filter%5Bcodeid%5D=eeee
有人對如何管理這個任何想法?
編輯:
我使用JSON-API
https://github.com/ethanresnick/json-api
這是我的所有路由我的服務器上的文件:下面
綁定路徑是'/ api/tests','?filter%5Bcodeid%5D = eeee'是請求參數。你可以綁定'/ api/test/filter-:codeid'。 –
相同的東西它不起作用 –