https://github.com/prawee/node-simulator-api-server
simulator api for client test
https://github.com/prawee/node-simulator-api-server
api-server nodejs simulator-api
Last synced: about 1 month ago
JSON representation
simulator api for client test
- Host: GitHub
- URL: https://github.com/prawee/node-simulator-api-server
- Owner: prawee
- Created: 2016-08-15T08:30:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-15T09:23:23.000Z (almost 10 years ago)
- Last Synced: 2025-01-14T11:03:47.574Z (over 1 year ago)
- Topics: api-server, nodejs, simulator-api
- Language: JavaScript
- Size: 2.31 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#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