json-server
json-server copied to clipboard
Getting nested resources doesn't work
This does not work for me. Returns Not found. I use version ^1.0.0-beta.0.
For nested resources to work, you need to structure your db.json this way:
{
"environments": [
{ "id": 12 },
{ "id": 19 }
],
"reports": [
{ "id": 17, "environmentId": 12 },
{ "id": 25, "environmentId": 12 }
]
}
Then /environments/12/reports should return reports that have environmentId === 12
Originally posted by @typicode in https://github.com/typicode/json-server/issues/72#issuecomment-99162206