Requirements
Your system must have the following applications
- Node JS (To run npm scripts)
- Postman (to test API URLs)
- Dummy Json Server (to get fake JSON data)
Download and Install free Postman software to test the API.
First, you need a dummy API to test and learn.
Run the following code in the command prompt to install the JSON server
$ npm install -g json-server
Create a project folder. Inside the folder, create a file named “db.json” and paste the following code and save the file.
{ "employees": [ { "id": 1, "first_name": "Raj", "last_name": "kumar", "email": "[email protected]" }, { "id": 2, "first_name": "Ram", "last_name": "Saran", "email": "[email protected]" }, { "id": 3, "first_name": "Ventha", "last_name": "Kumar", "email": "[email protected]" } ] }
Open That folder in terminal and run the following code.
$ json-server --watch db.json
You will get the localhost path like this
Resources
http://localhost:3000/employees
Home
http://localhost:3000
Reference:-
Create a A REST API With Dummy JSON Server