I am working with json-server. I have installed it with npm install -g json-server and am watching using
json-server --watch db.json
I have added db.json file in app folder with below data
{
"product": [
{
"userId": 1,
"firstName": "Krish",
"lastName": "Lee",
"phoneNumber": "123456",
"emailAddress": "[email protected]"
},
{
"userId": 5,
"firstName": "jone",
"lastName": "mac",
"phoneNumber": "111111111",
"emailAddress": "[email protected]"
}
]
}
but only http://localhost:3000/ is working. It shows
Congrats!
You're successfully running JSON Server
✧*。٩(ˊᗜˋ*)و✧*。
Resources
/posts 1x
/comments 1x
/profile object
To access and modify resources, you can use any HTTP method:
GET POST PUT PATCH DELETE OPTIONS
undefined
Documentation
README
To replace this page, create a ./public/index.html file.
http://localhost:3000/product is not working. How can I fix this issue?
json-serverwhen it starts up? I see it list the resource endpoints, includinghttp://localhost:3000/productwhich works fine. Your posted JSON is malformed, with an invalid trailing comma, but I assume that's an artifact of cutting it down to post (becausejson-servererrors out if given malformed JSON). Please give a minimal reproducible example.