- Able to
GET
,POST
,PUT
,PATCH
,DELETE
,OPTIONS
. - Changes are persisted between calls.
- Clone this repository on terminal
git clone <url>
. - Open cloned directory
simple-api-for-testing
. - If you haven't installed
json-server
, typenpm i json-server
on terminal to install. - After installation, start JSON Server locally by typing
json-server --watch db.json
on terminal. - Server is started locally on
http://localhost:3000
.
Run this command: sudo chown -R $USER /usr/local/lib/node_modules
sudo
means running the command as the system super user, root user.chown
changes the owner of the file or folder.-R
changes the owner, so that we can get root access to all files inside the node_modules folder.$USER
is an environment variable, and by default it is your system username.- Finally, you can
npm install -g json-server
.
{
"player": [
{
"id": 1,
"name": "John Doe",
"hobbies": [
"Cycling",
"Netlix",
"Travelling"
],
"addresses": [
{
"addressId": "1",
"postalCode": "7400",
"country": "Malaysia",
"state": "Kuala Lumpur",
"line1": "Jane Street, 191"
}
]
},
{
"id": 2,
"name": "Marry Lane",
"hobbies": [
"Rock climbing",
"Eating"
],
"addresses": [
{
"addressId": "1",
"postalCode": "2100",
"country": "Malaysia",
"state": "Selangor",
"line1": "Elementi, 200"
}
]
}
]
}