Fake Backend API using JSON Server
Jan 26, 2023
Simple Fake Backend using JSON Server. Official docs
Preparation
Install via npm:
npm install -g json-server
Create db.json file
{
"users": [
{
"id": 1,
"username": "user1",
"password": "password"
},
{
"id": 2,
"username": "user2",
"password": "password"
}
]
}
Run via terminal/CMD
json-server --watch db.json
Open localhost:3000
Test GET users with localhost:3000/users
Test GET users with localhost:3000/users/?id=1
Create User by POST localhost:3000/users/
{
"username": "user3",
"password": "password"
}