2016-11-25 55 views
1

我正在嘲笑Express中的POST路由以测试MS XRM。Node Express中的括号POST找不到路由

工作路线:

http://localhost:3000/api/data/v8.0/something 

app.post('/api/data/v8.0/something', function (req, res) { 
    res.send({data:'1234A'}); 
}); 

失败路线:

http://localhost:3000/api/data/v8.0/something(ABC)/somethingelse 

app.post('/api/data/v8.0/something(ABC)/somethingelse', function (req, res) { 
    res.send({data:'1234A'}); 
}); 
+0

试用'%29'代替'('用'%28'和')'' – Gaurav

+0

嗨,我不能在发送端改变它,但我哈我试图改变路线编码,它不起作用。 –

回答

1

括号中的路由路径具有特殊的意义,但它看起来像你这样的转义:

app.post('/api/data/v8.0/something[(]ABC[)]/somethingelse', function (req, res) { 
    res.send({data:'1234A'}); 
}); 
+0

谢谢!这就是答案! –