url重写- couchapp:不同的重写带和不带正斜杠的url



基本上,我想为这些url重写两个不同的规则:http://127.0.0.1:5984/test/_design/myapp/_rewrite/docs/abchttp://127.0.0.1:5984/测试/_design/myapp/_rewrite/docs/abc/

第一个将被重写为http://127.0.0.1:5984/test/_design/myapp/_show/single/abc而第二个将被重写为http://127.0.0.1:5984/test/_design/myapp/_list/container/all

I tried doing this:

{
    "---": "Container Retrieval",
    "method": "GET",
    "from": "/docs/*/",
    "to": "/_list/basic-container/all"
  }

两个url(带和不带正斜杠)都重定向到http://127.0.0.1:5984/test/_design/myapp/_list/container/all。couchDB似乎忽略了URL末尾的正斜杠。

这个问题的可能解决方案是什么?

星号捕获下面的整个路径。试试下面的命令:

{
  "method": "GET",
  "from": "/docs/:id",
  "to": "/_show/single/:id"
},
{
  "method": "GET",
  "from": "/docs/:id/",
  "to": "/_list/basic-container/all"
}

最新更新