Why does fetching an ID give me an 404 error

55 Views Asked by At

When I'm trying to GET an ID I got an 404 error on any API client. I tried: POSTMAN, INSOMNIA and THUNDER CLIENT.

I did a npm install
npm install -g json-server
and
json-server --watch db.json -p 3200

This is my db.json file :

{
  "notes": [
    {
      "title": "React - Props",
      "content": "Props are data I can send to a component. You can send any kind of data : Objects, strings, numbers, arrays, jsx...\nYou can never modify a props directly they are read-only. Any time a component props changes the component re-render.\n\nExample : \n\n<Component myProps=\"This is a props\" />",
      "created_at": "23/08/2022",
      "id": 2
    },
    {
      "title": "React - States",
      "content": "A state is a data managed by a component. Any time a component state changes the component re-render",
      "created_at": "23/08/2022",
      "id": 5
    },
    {
      "title": "React - Hooks",
      "content": "Hooks are function that let you use states and other React features. \n\nuseEffect() and useState() are two famous React hooks. ",
      "created_at": "23/08/2022",
      "id": 6
    }


  ]
}

Also my GitHub repos: https://github.com/seylioneldev/react-notes-manager/tree/main

http://localhost:3200/notes is working. I can get all the data but http://localhost:3200/notes/2 don't work.

Tried to get an ID but using http://localhost:3200/notes/2

0

There are 0 best solutions below