json-server icon indicating copy to clipboard operation
json-server copied to clipboard

Custom routes.json not working with :parameters

Open strom opened this issue 8 years ago • 6 comments

I tried to reproduce the following locally: https://github.com/typicode/json-server/issues/167

I copied the route to my routes.json:

"/Data/Items/:itemId/Document/:id.json": "/Document/:id"

I then added Document to my db.js file in my js function that returns JSON.

"document": [
    {
      "id": 346,
      "itemId": 42,
      "foo": "bar",
      "body": "some data"
    }
  ]

Navigating to the /document route works, the rewritten route does not.

This is the route I tried to hit: /Data/Items/3/Document/2.json

strom avatar Feb 08 '17 22:02 strom