-1

I have the following db.json

{
   "cases":{
      "TotalCount":1,
      "StartingPageNumber":1,
      "Data":[
         {
            "Id":1,
            "CaseNumber":"1234",
            "CaseDescription":"Descpp something",
            "CaseDate":"08-28-2020"
         },
         {
            "Id":2,
            "CaseNumber":"4567",
            "CaseDescription":"Descpp somthing again",
            "CaseDate":"08-28-2020"
         },
         {
            "Id":3,
            "CaseNumber":"7654",
            "CaseDescription":"also an Descpp",
            "CaseDate":"08-28-2020"
         },
         {
            "Id":4,
            "CaseNumber":"3322",
            "CaseDescription":"again a Descpp",
            "CaseDate":"08-28-2020"
         }   
      ]
   }
}

my url looks like http://localhost:3000/cases. I can see all the data but when I just want to retrieve only case with Id 1 from the Data

I have been doing alot of reading / trying over past couple of days on how to acess Data inside of json using the json-server to mock apis, can someone guide me in the right direction please.

Jeff Benister
  • 468
  • 3
  • 12

2 Answers2

0

This is not an answer unless someones comes up with one but looks like this is not possible to do as per json-server https://github.com/typicode/json-server/issues/875

Jeff Benister
  • 468
  • 3
  • 12
-1

use the following pattern for json server, I hope this works ! :)

http://localhost:3000/cases/1?_embed=Data