Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 未找到节点快速投递路线中的括号_Node.js_Express - Fatal编程技术网

Node.js 未找到节点快速投递路线中的括号

Node.js 未找到节点快速投递路线中的括号,node.js,express,Node.js,Express,我在模拟Express中的POST route以测试MS XRM 工作路线: 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.po

我在模拟Express中的POST route以测试MS XRM

工作路线:

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'});
});
失败路线:

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'});
});

route Path中的括号有特殊含义,但看起来您可以像这样对其进行转义:

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

尝试将
替换为
%28
替换为
%29
嗨,我无法在发送端更改它,但我已尝试将路由更改为encoded,但它不起作用。谢谢!这就是答案!