-
To install :
npm install -g json-server
-
Create a
db.json
with some data :
{
"users":[
{
"id":1,
"first_name":"Ashish",
"last_name":"Ghosh",
"job":"test automation"
}
]
}
-
To start JSON Server :
json-server --watch db.json
-
To access data, you can hit this url : http://localhost:3000/users/1
You should get the following output :
{
"users":[
{
"id":1,
"first_name":"Ashish",
"last_name":"Ghosh",
"job":"test automation"
}
]
}
For more on JSON Server visit this link.