- Create a new directory with the name QuickFresh
- Navigate inside the folder and open VS Code inside it
- Now, create a
index.js
file inside this directory - Using the terminal initialize
npm
in this directory - Using
npm
install the ExpressJS module - Inside the
index.js
file perform the following:
-
Import and initialize ExpressJS
-
Set the Port to 9000
-
Create a route "/", where the handler function returns the text
Welcome to QuickFresh
for a GET request -
Create a route "/about", where the handler function returns the html
<h3>We are Vadodara's most trusted grocery delivery service></h3>
for a GET request -
Create a route "/contact", where the handler function returns the JSON
{"email":"[email protected]", "instagram": "http://instagram.com/quickfresh"}
for a GET request -
Initiate the server to listen at the given port with a message
Server running on http://localhost:9000
as an output when it is started
Bonus:
-
Sign up for Postman
-
Install the VS Code Extension
-
Login to your Account
-
Create a collection called
QuickFresh
-
Test GET requests at all the three routes: "/", "/about", "/contact"
Attach Screenshots for the same