Unit 5
Unit 5
1
TABLE OF
CONTENTS
Who We Are
What is Full Stack
MVC Architecture
React Js
Live Session - Frontend
Backend + Database
Live Session - Backend
Bonus Slide
Q/A Session
2
WHO WE ARE
PRODUCT
OVERVIE
W
linkedin.com/in/vijaypradeepmedida/ linkedin.com/in/mehdi-hussain-mohammed-88942886/
3
What is Full Stack
Development ?
Full-stack development refers to the process of building both the front-end
(client-side) and back-end (server-side) parts of a web application. A
full-stack developer is proficient in handling everything from the user
interface (UI) to the server logic, databases, and API integrations.
4
5
6
MVC Model Overview
● Model:
● View:
● Controller:
7
Front-end (React Js)
8
What is React JS ?
• A popular JavaScript library for building user interfaces,
mainly for single-page applications (SPAs).
• Focus on UI
9
● Component-Based Architecture – Reusable UI
components.
10
Setting up React Js application
● Prerequisites:
○ Install Node.js
○ Install npm / Yarn
○ Basic JavaScript knowledge (ES6+ Concepts)
○ Code editor (VS Code)
● Installation Methods:
○ Using Create React App:
■ npx create-react-app my-app
■ cd my-app
■ npm start
11
• my-app
Structure
• public – Static assets
• src – Main codebase (App.js,
index.js,styles.css)
12
Components
13
14
Component ● Functional Components (Stateless)
15
Functional Components Class Components
Hooks Support Yes (useState, useEffect, etc.) No (must use lifecycle methods)
Since React 16.8, functional components with Hooks have become the standard way to build React
applications
17
Props and State in React
18
Props in React
Props is Read-only properties passed from parent to child.
19
State in React
What is State?
Mutable data that affects component behavior.
20
When to Use the State?
• When data changes dynamically within a component.
21
Lifecycle methods
22
➢ Mounting (Component is created)
● constructor()
● render()
● componentDidMount()
23
➢ Updating (Component re-renders due to state/props
change)
● shouldComponentUpdate(nextProps, nextState)
● render()
● getSnapshotBeforeUpdate(prevProps, prevState)
24
➢ Unmounting (Component is removed)
● componentWillUnmount()
● componentDidMount()
● componentDidUpdate()
● componentWillUnmount()
25
26
React Hooks(useEffect)
● useEffect(() => {
/* code */
}, []);
27
“Hands-On” with React
28
“Your Questions,
Our Answers”
29
Break Time
10 Minutes
Backend!!!
31
Backend: The backend is the part of a web application that runs on the server, responsible for
managing data, handling logic, and ensuring everything works behind the scenes. It interacts with
databases, processes requests from the frontend (the part users interact with), and sends responses back
to the frontend.
In simpler terms, the backend is like the engine of a car that makes everything run smoothly, but you don't
directly see it while using the car.
REST APIs: REST (Representational State Transfer) is an architectural style for designing web
services. A REST API is a way for different software systems to communicate with each other over the
internet using HTTP methods like GET, POST, PUT, and DELETE. It allows clients (like your web
browser or mobile app) to interact with the backend by sending requests and receiving responses,
usually in a format like JSON.
Think of a REST API like a waiter at a restaurant who takes your order (request), brings you your food
(response), and allows you to interact with the kitchen (backend).
32
Express JS
Node Js
33
Setup and Installations
Commands:
● npm init
● npm i express
● npm i mongoose
● npm i nodemon
● npm i cors
34
What is Express.js?
Express.js is a fast, minimal web framework for Node.js, designed to simplify back-end development. It offers flexibility in
application structure, enabling quick development of RESTful APIs. With its efficient routing, middleware integration, and
support for dynamic content rendering, Express allows developers to build scalable, high-performance applications with ease.
35
What is Node.js?
● Node.js is an open-source runtime environment that allows JavaScript to be executed on the server-side. It offers
high performance and efficiency.
● In the MERN stack, Node.js serves as the back-end environment, enabling seamless communication between the
front-end (React) and the database (MongoDB). With its extensive ecosystem of libraries through npm, Node.js
accelerates development and enhances scalability for web applications.
36
What is MongoDB?
● MongoDB is a NoSQL database that stores data in a flexible, JSON-like format called
BSON (Binary JSON). Unlike traditional relational databases, MongoDB allows for the
storage of unstructured and semi-structured data, making it highly scalable and
flexible.
● Document: A record in MongoDB, similar to a row in a relational database, stored as a set of key-value pairs.
● JSON (JavaScript Object Notation): A lightweight data format used to exchange data, similar to MongoDB’s BSON
format.
● Field: A key-value pair within a document, where the key is the field name and the value is the associated data.
● Cluster: A cluster in MongoDB is like a group of computers working together to store and manage your data. This helps
keep everything running smoothly even when there's a lot of data or traffic, making sure the system doesn't crash.
● Mongoose: Mongoose is a package that makes it easier to interact with MongoDB from your Node.js applications. It
helps organize your data and makes it simpler to perform tasks like saving, updating, and retrieving information from the
database.
37
SQL vs NoSQL
38
Live Session
39
BONUS SLIDE 🎉
POSTMAN
40
Postman is a popular tool used by developers to test and interact with APIs (Application
Programming Interfaces). With Postman, you can organize requests and manage API environments,
making it a valuable tool for both development and testing of apis.
● API Testing Made Easy: Postman allows you to test APIs without writing any code. You can quickly send HTTP requests
(GET, POST, PUT, DELETE) and see the responses.
● User-Friendly Interface: It has an easy-to-use graphical interface, making it beginner-friendly for students who are new
to API development and testing.
● Request Customization: You can customize headers, parameters, and request bodies to simulate real-world API calls.
● Collections: You can organize your API requests into collections, which helps keep your work neat and easy to access.
● Environment Management: Postman lets you create different environments (like development, testing, or production) so
you can easily switch between configurations.
● Collaboration: Students can share Postman collections with teammates, making group work and collaboration easier.
● Learning and Debugging: It helps students understand how APIs work and is a great tool for debugging and
troubleshooting API issues.
41
Any
Questions?
42
What we covered ?
!fullStackDeveloper fullStackDeveloper
React Js Mongodb
43
WHO WE ARE
44
Sources
React doc: https://react.dev/
Youtube: https://youtu.be/SqcY0GlETPk?si=i4YA3gD9VsQ-GMzz
Youtube: https://www.youtube.com/watch?v=_7UQPve99r4
45
Let’s assess
what we
have
LEARNED
46
1.What is the primary purpose of ReactJS?
a) To style HTML elements.
b) To manage server-side routing.
c) To build dynamic user interfaces.
d) To handle database interactions.
47
1.What is the primary purpose of ReactJS?
a) To style HTML elements.
b) To manage server-side routing.
c) To build dynamic user interfaces.
d) To handle database interactions.
48
2.Which of the following is a key feature
of React?
a) Two-way data binding.
b) Direct manipulation of the DOM.
c) Component-based architecture.
d) Server-side rendering only.
49
2.Which of the following is a key feature
of React?
a) Two-way data binding.
b) Direct manipulation of the DOM.
c) Component-based architecture.
d) Server-side rendering only.
50
3.What are "props" primarily used for in
React?
a) To manage data within a component.
b) To pass data from a parent component to a child component.
c) To style individual components.
d) To define the structure of a component.
51
3.What are "props" primarily used for in
React?
a) To manage data within a component.
b) To pass data from a parent component to a child component.
c) To style individual components.
d) To define the structure of a component.
52
4.How do you typically update the state
of a class component?
a) By using the this.setState() method.
b) By calling the updateState() method.
c) By directly assigning a new value to this.state.
d) By emitting an event to trigger a state change.
53
4.How do you typically update the state
of a class component?
a) By using the this.setState() method.
b) By calling the updateState() method.
c) By directly assigning a new value to this.state.
d) By emitting an event to trigger a state change.
54
5.What is the fundamental building block
of a React application?
a) HTML tags.
b) Components.
c) JavaScript functions.
d) CSS selectors.
55
5.What is the fundamental building block
of a React application?
a) HTML tags.
b) Components.
c) JavaScript functions.
d) CSS selectors.
56
6.Before the introduction of hooks, which
type of component was primarily used for
managing state and lifecycle methods?
a) Functional components.
b) Class components.
c) Pure components.
d) Higher-order components.
57
6.Before the introduction of hooks, which
type of component was primarily used for
managing state and lifecycle methods?
a) Functional components.
b) Class components.
c) Pure components.
d) Higher-order components.
58
7.In which lifecycle method should you
typically perform cleanup actions, such
as clearing timers or canceling network
requests?
a) componentDidUpdate()
b) render()
c) componentDidMount()
d) componentWillUnmount()
59
7.In which lifecycle method should you
typically perform cleanup actions, such
as clearing timers or canceling network
requests?
a) componentDidUpdate()
b) render()
c) componentDidMount()
d) componentWillUnmount()
60
8.How can you make useEffect run only
once after the initial render, similar to
componentDidMount?
a) By not providing any arguments to useEffect.
b) By providing a dependency array with all the props and state
variables.
c) By providing an empty dependency array [] as the second argument.
d) By using a conditional statement inside the useEffect callback.
61
8.How can you make useEffect run only
once after the initial render, similar to
componentDidMount?
a) By not providing any arguments to useEffect.
b) By providing a dependency array with all the props and state
variables.
c) By providing an empty dependency array [] as the second argument.
d) By using a conditional statement inside the useEffect callback.
62
9.Imagine a light switch. It can be either "on" or
"off," and when you flip it, its state changes. In a
React component, what is the data that can change
and affect what's displayed on the screen called?
a) Props
b) Events
c) Styles
d) State
63
9.Imagine a light switch. It can be either "on" or
"off," and when you flip it, its state changes. In a
React component, what is the data that can change
and affect what's displayed on the screen called?
a) Props
b) Events
c) Styles
d) State
64
10.Code Question:
Consider the following simple functional React component:
a) Hello, User!
b) Greetings!, User!
c) Hello, Greetings!!
d) The component will not render due
to an error.
65
10.Code Question:
Consider the following simple functional React component:
a) Hello, User!
b) Greetings!, User!
c) Hello, Greetings!!
d) The component will not render due
to an error.
66