@kdyou/fake-restserver
v1.0.0
Published
A quick tool for testing REST requests
Downloads
1
Readme
Fake REST-Server
Fake REST-Server is an install and run tool for testing. It supports GET, POST, PUT, PATCH and DELETE HTTP methods with JSON format on request and response.
Installation
npm i -D fake-restserver
Usage
npx fake-restserver
| Parameter | Description | Default |
|---------------|--------------|---------|
| --port=3000
| Server port (Optional) | 8000
|
Examples
Start Fake REST-Server, then run curl on a new terminal:
curl -X POST -d '{"first_name":"John","last_name":"Smith","email":"[email protected]"}' http://localhost:8000/students
You can now get your data:
curl http://localhost:8000/students
curl http://localhost:8000/students/1
And do some update:
curl -X PUT -d '{"first_name":"John","last_name":"Smith","email":"[email protected]"}' http://localhost:8000/students/1
curl -X PATCH -d '{"email":"[email protected]"}' http://localhost:8000/students/1
curl -X DELETE http://localhost:8000/students/1