0% found this document useful (0 votes)
6 views

Ex No 9

This document outlines the steps to build a RESTful API using Express.js, including setting up the environment and creating necessary files and folders. It details the installation of required packages like Express, Mongoose, and Nodemon, as well as the creation of routes and a MongoDB collection. Additionally, it mentions using a REST CLIENT extension in VSCode for sending requests and receiving responses.

Uploaded by

vanisris.mca
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
0% found this document useful (0 votes)
6 views

Ex No 9

This document outlines the steps to build a RESTful API using Express.js, including setting up the environment and creating necessary files and folders. It details the installation of required packages like Express, Mongoose, and Nodemon, as well as the creation of routes and a MongoDB collection. Additionally, it mentions using a REST CLIENT extension in VSCode for sending requests and receiving responses.

Uploaded by

vanisris.mca
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/ 4

9. Build a RESTful API using Express.

js with endpoints for creating, reading, updating,


and deleting data

Step 1: First we need to setup the environment.


Step 2: Create a new folder with any name (Ex: ExpressMongoDb).
Step 3: Command to create Nodejs project npm init -y
Step 4: Next install express, mongoose , nodemon
Command: npm install express , npm install mongoose, npm –save-dev dotenv
nodemon
Express – for server,
Mongoose – for database,
Nodemon – for server refresh

Step 5: Create server.js file and create server

Step 6: Create a folder routes and place all the routes . Create a file subscribers.js
Step 7: Creating a MongoDb collection and Schema

Step 8: Install REST CLIENT Extension for sending requests through VSCODE
STEP 9: By Using REST CLIENT We can send request and get response in VSCode itself

The above image is the output

You might also like