Json-server: Custom routes.json not working with :parameters

Created on 8 Feb 2017  路  4Comments  路  Source: typicode/json-server

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

Most helpful comment

I've noticed the same thing, and also that filters such as the below don't work:

'/v1/accounts/:account_id/resource': '/resource?account_id=:account_id'

All 4 comments

I forgot to mention I'm running [email protected]

I've noticed the same thing, and also that filters such as the below don't work:

'/v1/accounts/:account_id/resource': '/resource?account_id=:account_id'

I am also having the routes not filtering the results issue.
The following routes.json is not retuning the filtered result

{
"/data/StandardList" : "/StandardList?_start=0&_end=3" 
}

I am also having the same issue. Seems related to another issue too. I think its any kind of property used in the url that isn't :id.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ashleydavis picture ashleydavis  路  3Comments

casvil picture casvil  路  4Comments

jasonlimantoro picture jasonlimantoro  路  4Comments

Rutvik17 picture Rutvik17  路  4Comments

melnikovic picture melnikovic  路  3Comments