Ap EX 1
Ap EX 1
1. Aim:
Full Stack Development (MERN).
The primary aim of this experiment is to provide students or developers with an understanding of
full-stack development involving MongoDB, Node.js, React, and Express.
➢ Problem 1.1.1: Give understanding of MongoDB, Nodejs, React, Express.
➢ Problem 1.1.2: Create a Frontend design of Login/Signup pages and create a backend of it.
Problem Breakdown.
➢ Problem 1.1.3: Test the Backend API Using Postman.
• MongoDB: A NoSQL database that stores data in a flexible, JSON-like format, which is
great for handling unstructured data.
• Express.js: A minimal and flexible Node.js web application framework that simplifies
routing and handling HTTP requests.
• React: A JavaScript library for building user interfaces, particularly for single-page
applications. It allows developers to create dynamic web applications with ease.
• Node.js: A JavaScript runtime environment that lets you run JavaScript code on the
server-side, enabling full-stack JavaScript development.
The MERN stack is highly favored for its ease of use, scalability, and the fact that it allows
developers to work in JavaScript across both the client and server sides.
3. Implementation/Code:
➢ BACKEND
git clone
cd backend npm
install const {
MongoClient,
ServerApiVersio
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
n } =
require('mongod
b'); const uri =
"mongodb+srv://rosh63441:<password>@rosh.yhbuk.mongodb.net/?retryWrites=true&w=major
ity&appName=Rosh";
// Create a MongoClient with a MongoClientOptions object to set the Stable API version const
client = new MongoClient(uri, {
serverApi: {
version: ServerApiVersion.v1,
strict: true,
deprecationErrors: true,
}
});
try {
const db = client.db('auth'); const
users = db.collection('users');
try { const db =
client.db('auth');
const users = db.collection('users');
➢ FRONTEND
cd fronted npm
install
npm start
4. Output
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Learning Outcome
• Learn about MongoDB: Understand how to use MongoDB as a NoSQL database for
storing and retrieving user data.
• Learn about Node.js: Understand how to set up and use Node.js as a backend server and
handle API requests.
• Learn about Express.js: Understand how to use Express.js to create routes and handle
HTTP requests in the Node.js server.
• Learn about React: Learn how to create a simple frontend interface with React to handle
user interactions (login/signup).
• Backend API Testing: Use tools like Postman to test backend APIs and ensure the server
is responding correctly.
• Integration: Integrate the frontend (React) with the backend API to create a full-stack
authentication system.