100% found this document useful (1 vote)
485 views9 pages

How To Create Dummy APIs

The document outlines steps to create a dummy API using NodeJS and json-server by installing NodeJS and json-server, creating a students.json file with sample data, and running json-server to make the API available at a local URL.

Uploaded by

Sid Mars
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
485 views9 pages

How To Create Dummy APIs

The document outlines steps to create a dummy API using NodeJS and json-server by installing NodeJS and json-server, creating a students.json file with sample data, and running json-server to make the API available at a local URL.

Uploaded by

Sid Mars
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

How to create dummy API's

1) Install NodeJS
Download link: https://nodejs.org/en/download/
Set Environment variable:

2) Check node & npm versions ( npm comes along with node.js)

3) install json-server
npm install -g json-server
Ignore this

4) create students.json file with the following data


{
"students": [
{
"id": 1,
"name": "John",
"location": "india",
"phone": "1234567890",
"courses": [
"Java",
"Selenium"
]
},
{
"id": 2,
"name": "Kim",
"location": "US",
"phone": "98876543213",
"courses": [
"Python",
"Appium"
]
},
{
"id": 3,
"name": "Smith",
"location": "Canada",
"phone": "165498765",
"courses": [
"C#",
"RestAPI"
]
}
]
}
5) Run the below command to make your API's up and running.

json-server --watch students.json

http://localhost:3000/students

You might also like