******************************************************************************
How to Fake or Mock an API with JSON Server
******************************************************************************JSON Server is an easy and quick-to-set-up module that you can use to fake or mock an API.
Getting Started:
1. Install node.JS on your system
2. Exeute below command to install json-server globally
npm install -g json-server
Eg. C://User/json-server/db.json
4. db.json file contains below simple json, you can have any complex json in db.json file.
4. Once the db.json file is created, navigate to the folder where the file is saved.
From the folder path, open a command widow and type the command
json-server --watch db.json
6. Open POSTMAN, Create GET request with API 'http://localhost:3000/employees'
Hit Send button
You should be able to see the response
Now, you have successfully faked REST APIT with json server and you can play around with your json server with CRUD operations.
------------------------------------------------------------------------------
No comments:
Post a Comment