1.0.0 • Published 1 year ago

@kdyou/fake-restserver v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

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
ParameterDescriptionDefault
--port=3000Server 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":"johnsmith@mailer.net"}' 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":"johnsmith@mailer.net"}' http://localhost:8000/students/1
curl -X PATCH -d '{"email":"johnsmith@mailer.net"}' http://localhost:8000/students/1
curl -X DELETE http://localhost:8000/students/1