Skip to content

prawee/node-simulator-api-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Clone and Install Clone

cd /var/www/
git clone https://github.com/prawee/node-simulator-api-server.git json-server
cd json-server

Install Package

npm install
or 
npm i 

#Run

json-server --watch faker.js 
or 
json-server --w faker.js

#View open your browser and then http://localhost:3000/users

#RESTFul POST

curl -X POST -H "Content-type: application/json"  localhost:3000/users -d '{"name": "Prawee Wongsa" }'
{
  "name": "Prawee Wongsa",
  "id": 51
}

GET (all)

curl -X GET -H "Content-type: application/json"  localhost:3000/users

GET (some)

curl -X GET -H "Content-type: application/json"  localhost:3000/users/51
{
  "name": "Prawee Wongsa",
  "id": 51
}

DELETE

curl -X DELETE -H "Content-type: application/json"  localhost:3000/users/51
{}

#More Information about Tools https://github.com/typicode/json-server

Releases

No releases published

Packages

No packages published