Check Empty Object - Javascript Interview #dsa #interview #coding
https://youtube.com/shorts/O3EGfDC-6Yc?feature=share
https://youtube.com/shorts/O3EGfDC-6Yc?feature=share
YouTube
Check Empty Object - Javascript Interview #dsa #interview #coding
Check if an object is empty in JavaScript using a simple interview-ready approach.In this short video, you will learn how to use Object.keys() to detect whet...
β€1
Now, let's move to the next topic in Web Development Roadmap:
π *REST APIs & Routing in Express*
Now you move from basic server β real backend API structure.
If you understand this topic properly, you can build production-level APIs.
π§ *What is a REST API?*
REST = Representational State Transfer
Simple meaning:
π Backend exposes URLs
π Frontend sends HTTP requests
π Backend returns data (usually JSON)
π₯ *REST API Structure*
REST follows resources-based URLs.
Example resource: users
Instead of:
REST style:
π *HTTP Methods in REST*
GET -> Read data
POST -> Create data
PUT -> Update data
DELETE -> Remove data
These map directly to CRUD.
π§© *Basic REST API Example*
Step 1: Setup Express
const express = require("express");
const app = express();
app.use(express.json()); // middleware for JSON
let users = [
{ id: 1, name: "Amit" },
{ id: 2, name: "Rahul" }
];
π 1οΈβ£ GET β Fetch all users
app.get("/users", (req, res) => {
res.json(users);
});
β 2οΈβ£ POST β Add new user
app.post("/users", (req, res) => {
const newUser = {
id: users.length + 1,
name: req.body.name
};
users.push(newUser);
res.json(newUser);
});
βοΈ 3οΈβ£ PUT β Update user
app.put("/users/:id", (req, res) => {
const id = parseInt(req.params.id);
const user = users.find(u => u.id === id);
if (!user) {
return res.status(404).json({ message: "User not found" });
}
user.name = req.body.name;
res.json(user);
});
β 4οΈβ£ DELETE β Remove user
app.delete("/users/:id", (req, res) => {
const id = parseInt(req.params.id);
users = users.filter(u => u.id !== id);
res.json({ message: "User deleted" });
});
βΆοΈ *Start Server*
app.listen(3000, () => {
console.log("Server running on port 3000");
});
π§ *What is Routing?*
Routing means:
π Matching URL
π Matching HTTP method
π Running correct function
*Example:*
GET /users β fetch users
POST /users β create user
π *Better Folder Structure (Real Projects)*
project/
βββ routes/
β βββ userRoutes.js
βββ controllers/
βββ server.js
Separation of concerns = scalable backend.
β οΈ *Common Beginner Mistakes*
β’ Not using express.json()
β’ Not parsing req.params correctly
β’ Not sending status codes
β’ Not handling missing data
π§ͺ *Mini Practice Task*
β’ Create REST API for products
β’ GET /products
β’ POST /products
β’ PUT /products/:id
β’ DELETE /products/:id
β‘οΈ *Double Tap β₯οΈ For More*
π *REST APIs & Routing in Express*
Now you move from basic server β real backend API structure.
If you understand this topic properly, you can build production-level APIs.
π§ *What is a REST API?*
REST = Representational State Transfer
Simple meaning:
π Backend exposes URLs
π Frontend sends HTTP requests
π Backend returns data (usually JSON)
π₯ *REST API Structure*
REST follows resources-based URLs.
Example resource: users
Instead of:
/addUser
/deleteUser
REST style:
POST /users
PUT /users/:id
DELETE /users/:id
π *HTTP Methods in REST*
GET -> Read data
POST -> Create data
PUT -> Update data
DELETE -> Remove data
These map directly to CRUD.
π§© *Basic REST API Example*
Step 1: Setup Express
const express = require("express");
const app = express();
app.use(express.json()); // middleware for JSON
let users = [
{ id: 1, name: "Amit" },
{ id: 2, name: "Rahul" }
];
π 1οΈβ£ GET β Fetch all users
app.get("/users", (req, res) => {
res.json(users);
});
β 2οΈβ£ POST β Add new user
app.post("/users", (req, res) => {
const newUser = {
id: users.length + 1,
name: req.body.name
};
users.push(newUser);
res.json(newUser);
});
βοΈ 3οΈβ£ PUT β Update user
app.put("/users/:id", (req, res) => {
const id = parseInt(req.params.id);
const user = users.find(u => u.id === id);
if (!user) {
return res.status(404).json({ message: "User not found" });
}
user.name = req.body.name;
res.json(user);
});
β 4οΈβ£ DELETE β Remove user
app.delete("/users/:id", (req, res) => {
const id = parseInt(req.params.id);
users = users.filter(u => u.id !== id);
res.json({ message: "User deleted" });
});
βΆοΈ *Start Server*
app.listen(3000, () => {
console.log("Server running on port 3000");
});
π§ *What is Routing?*
Routing means:
π Matching URL
π Matching HTTP method
π Running correct function
*Example:*
GET /users β fetch users
POST /users β create user
π *Better Folder Structure (Real Projects)*
project/
βββ routes/
β βββ userRoutes.js
βββ controllers/
βββ server.js
Separation of concerns = scalable backend.
β οΈ *Common Beginner Mistakes*
β’ Not using express.json()
β’ Not parsing req.params correctly
β’ Not sending status codes
β’ Not handling missing data
π§ͺ *Mini Practice Task*
β’ Create REST API for products
β’ GET /products
β’ POST /products
β’ PUT /products/:id
β’ DELETE /products/:id
β‘οΈ *Double Tap β₯οΈ For More*
β€1
NextJS Tutorial #25 - PUT Method | Backend and Frontend
https://youtu.be/gkrgnPPVsJM
https://youtu.be/gkrgnPPVsJM
YouTube
NextJS Tutorial #25 - PUT Method | Backend and Frontend
In this video, we learn how to create a PUT API in Next.js using the App Router to perform full data updates.
You will understand what a PUT API is, how it works, and how it differs from POST and PATCH. We explore the API folder structure, create a PUT methodβ¦
You will understand what a PUT API is, how it works, and how it differs from POST and PATCH. We explore the API folder structure, create a PUT methodβ¦
β€1
NextJS Tutorial #26 - DELETE Method | Backend and Frontend
https://youtu.be/EA1V97hbr28
https://youtu.be/EA1V97hbr28
YouTube
NextJS Tutorial #26 - DELETE Method | Backend and Frontend
In this video, we learn how to create a DELETE API in Next.js using the App Router to remove data from the backend.
You will understand what a DELETE API is, how the DELETE method works, and how to structure API routes properly inside the app/api folder.β¦
You will understand what a DELETE API is, how the DELETE method works, and how to structure API routes properly inside the app/api folder.β¦
π1
Throttle Function Explained | Javascript Interview #dsa #interview #coding
https://youtube.com/shorts/GONX674HePI?feature=share
https://youtube.com/shorts/GONX674HePI?feature=share
YouTube
Throttle Function Explained | Javascript Interview #dsa #interview #coding
Throttle function explained in JavaScript with a simple example.In this short video, you will learn how throttle controls function execution so it runs only ...
β€1
DSA #30 - Core Data Structures | Queue Interview Questions | Theory + Coding Practice
https://youtu.be/q0fFSkytB18
https://youtu.be/q0fFSkytB18
YouTube
DSA #30 - Core Data Structures | Queue Interview Questions | Theory + Coding Practice
DSA Phase-3 Core Data Structures tutorial focusing on Queue interview questions.
In this video you will revise important queue concepts, solve implementation-based questions, and understand common time complexity traps asked in coding interviews.
We willβ¦
In this video you will revise important queue concepts, solve implementation-based questions, and understand common time complexity traps asked in coding interviews.
We willβ¦
β€1
Deep Clone Object - Javascript Interview #dsa #interview #coding
https://youtube.com/shorts/GROeeu9_Y08?feature=share
https://youtube.com/shorts/GROeeu9_Y08?feature=share
YouTube
Deep Clone Object - Javascript Interview #dsa #interview #coding
Deep clone object in JavaScript explained with a simple interview-ready example.In this short video, you will learn the difference between reference copy and...
π1
Thank you everyone for your wonderful comments! π
These are just 10 screenshots, and many more are still remaining.
Your support and kind words mean a lot to me.
Thank you for being part of this learning journey.
http://youtube.com/post/UgkxuDESqXsq4v7bwEji7eEX6ObNhQuunvUS?si=Bu4ib6sWkJStyqet
These are just 10 screenshots, and many more are still remaining.
Your support and kind words mean a lot to me.
Thank you for being part of this learning journey.
http://youtube.com/post/UgkxuDESqXsq4v7bwEji7eEX6ObNhQuunvUS?si=Bu4ib6sWkJStyqet
β€2
NextJS Tutorial #28 - JWT Authentication | Login API, Token & Protected Routes
https://youtu.be/1f5h6ejGM-A
https://youtu.be/1f5h6ejGM-A
YouTube
NextJS Tutorial #28 - JWT Authentication | Login API, Token & Protected Routes
In this video, we implement JWT authentication in Next.js using a login API and protected routes.
You will learn how to generate a JWT token during login, verify the token in a protected API, and connect the authentication flow with the frontend. We alsoβ¦
You will learn how to generate a JWT token during login, verify the token in a protected API, and connect the authentication flow with the frontend. We alsoβ¦
β€1
Reverse String Without reverse() - Javascript Interview #dsa #interview #coding
https://youtube.com/shorts/AcF-OLPwwBA?feature=share
https://youtube.com/shorts/AcF-OLPwwBA?feature=share
YouTube
Reverse String Without reverse() - Javascript Interview #dsa #interview #coding
Reverse a string without using the reverse() method in JavaScript.In this short video, you will learn how to reverse a string using a simple loop from the la...
β€2
NextJS Tutorial #29 - Introduction to MongoDB
https://youtu.be/gdLVle8l6i8
https://youtu.be/gdLVle8l6i8
YouTube
NextJS Tutorial #29 - Introduction to MongoDB
In this video, we start the database section of the Next.js course and understand how MongoDB works with Next.js applications.
You will learn why databases are required in web applications, why MongoDB is commonly used with Next.js, and what a NoSQL databaseβ¦
You will learn why databases are required in web applications, why MongoDB is commonly used with Next.js, and what a NoSQL databaseβ¦
β€1
React Developer Mock Interview | 2+ Years Experience | Real Interview Questions
https://youtu.be/f_Gm0vTains
https://youtu.be/f_Gm0vTains
π1
NextJS Tutorial #30 - Install MongoDB Compass & Setup Database
https://youtu.be/Rs3Js5o9HTs
https://youtu.be/Rs3Js5o9HTs
YouTube
NextJS Tutorial #30 - Install MongoDB Compass & Setup Database
In this video, we install MongoDB Compass and set up our first MongoDB database for the Next.js project.
You will learn how to install MongoDB Compass, create a database, create collections, and insert a sample document. We also explore the MongoDB UI soβ¦
You will learn how to install MongoDB Compass, create a database, create collections, and insert a sample document. We also explore the MongoDB UI soβ¦
β€1
Check Value in Array | includes() - Javascript Interview #dsa #interview #coding
https://youtube.com/shorts/BVjzBvoNi-0?feature=share
https://youtube.com/shorts/BVjzBvoNi-0?feature=share
YouTube
Check Value in Array | includes() - Javascript Interview #dsa #interview #coding
Check if a value exists in an array interview question explained in JavaScript.In this short video, you will learn two ways to check if an array contains a s...
β€1
NextJS Tutorial #31 - Connect MongoDB with Next.js
https://youtu.be/XTq0xow5NH0
https://youtu.be/XTq0xow5NH0
YouTube
NextJS Tutorial #31 - Connect MongoDB with Next.js
In this video, we connect MongoDB with a Next.js application and set up the database connection using Mongoose.
You will learn how to install the mongodb package, create a database connection file, configure environment variables using .env.local, and testβ¦
You will learn how to install the mongodb package, create a database connection file, configure environment variables using .env.local, and testβ¦
β€1
*π Frontend Development Concepts You Should Know*
Frontend development focuses on building the user interface (UI) of websites and web applicationsβthe part users see and interact with in the browser. It combines design, structure, interactivity, and performance to create responsive and user-friendly web experiences.
*1οΈβ£ Core Technologies of Frontend Development*
Frontend development is built on three foundational technologies:
- *HTML (HyperText Markup Language)*: provides the structure of a webpage
- *CSS (Cascading Style Sheets)*: controls the visual appearance and layout
- *JavaScript*: adds interactivity and dynamic behavior to web pages
*2οΈβ£ Important Frontend Concepts*
- *Responsive Design*: ensures websites work properly across devices
- *DOM (Document Object Model)*: represents the structure of a webpage as objects
- *Event Handling*: frontend applications respond to user actions
- *Asynchronous Programming*: fetch data without reloading pages
*3οΈβ£ Frontend Frameworks & Libraries*
- *React*: popular JavaScript library for building component-based UI
- *Angular*: full frontend framework for large-scale applications
- Vue.js: lightweight framework known for simplicity and flexibility
*4οΈβ£ Styling Tools*
- *CSS Frameworks*: Tailwind CSS, Bootstrap, Material UI
- *CSS Preprocessors*: Sass, Less
*5οΈβ£ Frontend Development Tools*
- *VS Code*: code editor
- *Git*: version control
- *Webpack / Vite*: module bundlers
- *NPM / Yarn*: package managers
- *Chrome DevTools*: debugging
*6οΈβ£ Performance Optimization*
- lazy loading
- code splitting
- image optimization
- caching strategies
- minimizing HTTP requests
*7οΈβ£ Typical Frontend Development Workflow*
1. UI/UX Design
2. HTML Structure
3. Styling with CSS
4. Add JavaScript Interactivity
5. Integrate APIs
6. Test and debug
7. Deploy application
*8οΈβ£ Real-World Frontend Projects*
- Responsive Portfolio Website
- Weather App
- To-Do List Application
- E-commerce Product Page
- Dashboard UI
*Double Tap β₯οΈ For More*
Frontend development focuses on building the user interface (UI) of websites and web applicationsβthe part users see and interact with in the browser. It combines design, structure, interactivity, and performance to create responsive and user-friendly web experiences.
*1οΈβ£ Core Technologies of Frontend Development*
Frontend development is built on three foundational technologies:
- *HTML (HyperText Markup Language)*: provides the structure of a webpage
- *CSS (Cascading Style Sheets)*: controls the visual appearance and layout
- *JavaScript*: adds interactivity and dynamic behavior to web pages
*2οΈβ£ Important Frontend Concepts*
- *Responsive Design*: ensures websites work properly across devices
- *DOM (Document Object Model)*: represents the structure of a webpage as objects
- *Event Handling*: frontend applications respond to user actions
- *Asynchronous Programming*: fetch data without reloading pages
*3οΈβ£ Frontend Frameworks & Libraries*
- *React*: popular JavaScript library for building component-based UI
- *Angular*: full frontend framework for large-scale applications
- Vue.js: lightweight framework known for simplicity and flexibility
*4οΈβ£ Styling Tools*
- *CSS Frameworks*: Tailwind CSS, Bootstrap, Material UI
- *CSS Preprocessors*: Sass, Less
*5οΈβ£ Frontend Development Tools*
- *VS Code*: code editor
- *Git*: version control
- *Webpack / Vite*: module bundlers
- *NPM / Yarn*: package managers
- *Chrome DevTools*: debugging
*6οΈβ£ Performance Optimization*
- lazy loading
- code splitting
- image optimization
- caching strategies
- minimizing HTTP requests
*7οΈβ£ Typical Frontend Development Workflow*
1. UI/UX Design
2. HTML Structure
3. Styling with CSS
4. Add JavaScript Interactivity
5. Integrate APIs
6. Test and debug
7. Deploy application
*8οΈβ£ Real-World Frontend Projects*
- Responsive Portfolio Website
- Weather App
- To-Do List Application
- E-commerce Product Page
- Dashboard UI
*Double Tap β₯οΈ For More*
β€2
NextJS Tutorial #32 - Read Data from MongoDB in Next.js | GET API
https://youtu.be/8ANeJKzhoTI
https://youtu.be/8ANeJKzhoTI
YouTube
NextJS Tutorial #32 - Read Data from MongoDB in Next.js | GET API
In this video, we learn how to read data from MongoDB using a GET API in a Next.js application.
You will create an API route, connect the MongoDB database, and use the .find() method to fetch documents from the collection. We also convert the cursor intoβ¦
You will create an API route, connect the MongoDB database, and use the .find() method to fetch documents from the collection. We also convert the cursor intoβ¦
β€1
NextJS Tutorial #33 - Insert Data into MongoDB in Next.js | POST API
https://youtu.be/ZYCzPfrH7X4
https://youtu.be/ZYCzPfrH7X4
YouTube
NextJS Tutorial #33 - Insert Data into MongoDB in Next.js | POST API
In this video, we learn how to insert data into MongoDB using a POST API in a Next.js application.
You will create a POST API route, read request data using req.json(), and insert the data into a MongoDB collection using the insertOne() method. Finally,β¦
You will create a POST API route, read request data using req.json(), and insert the data into a MongoDB collection using the insertOne() method. Finally,β¦
π1
Check All Numbers Positive - Javascript Interview #dsa #interview #coding
https://youtube.com/shorts/VwgH9lN3k8k?feature=share
https://youtube.com/shorts/VwgH9lN3k8k?feature=share
YouTube
Check All Numbers Positive - Javascript Interview #dsa #interview #coding
Check if all numbers in an array are positive using JavaScript.In this short video, you will learn how to traverse an array and verify that every element is ...
β€1
*ποΈ Database Integration β MongoDB with Node.js*
Now you move from temporary data (arrays) β real database storage.
Backend apps must store data permanently.
That's where databases come in.
*π§ What is a Database*
A database stores data persistently.
*Examples:*
- E-commerce: Products, orders
- Social media: Users, posts
- Banking app: Transactions
*Without database β data disappears when server restarts.*
*π What is MongoDB*
MongoDB is a NoSQL database.
*Instead of tables β it stores documents (JSON-like data).*
*Example document:*
*Collection = group of documents*
*Database = group of collections*
*π¦ Why MongoDB is Popular*
β *JSON-like data*
β *Flexible schema*
β *Works perfectly with JavaScript*
β *Scales easily*
*Common in MERN stack.*
*MERN = MongoDB + Express + React + Node*
*π Connecting MongoDB with Node.js*
We use a library called Mongoose.
*Install:*
*β‘ Step 1 β Connect Database*
*Example:*
*Now Node server is connected to MongoDB.*
*π§© Step 2 β Create Schema*
*Schema defines data structure.*
*Example:*
*π Step 3 β Create Model*
*Model allows database operations.*
*β Step 4 β Create Data*
*π Step 5 β Fetch Data*
*β Step 6 β Delete Data*
*βοΈ Step 7 β Update Data*
*π Full Backend Flow Now*
*React β API request*
*Express β Handles route*
*Mongoose β Talks to MongoDB*
*MongoDB β Stores data*
*β οΈ Common Beginner Mistakes*
- *Forgetting to install mongoose*
- *Not using async/await*
- *Wrong MongoDB URL*
- *Not validating schema*
*π§ͺ Mini Practice Task*
*Build Product API with MongoDB*
*Routes:*
- POST /products
- GET /products
- PUT /products/:id
- DELETE /products/:id
*Fields:*
name
price
category
β *Mini Practice Task β Solution*
This solution implements:
β POST /products β Add product
β GET /products β Fetch products
β PUT /products/:id β Update product
β DELETE /products/:id β Delete product
π’ *Step 1 β Install Required Packages*
npm init -y
npm install express mongoose cors
π *Step 2 β Create server.js*
const express = require("express");
const mongoose = require("mongoose");
const cors = require("cors");
const app = express();
app.use(cors());
app.use(express.json());
/* ---------------- DATABASE CONNECTION ---------------- */
mongoose.connect("mongodb://127.0.0.1:27017/productdb")
.then(() => console.log("MongoDB connected"))
.catch(err => console.log(err));
/* ---------------- PRODUCT SCHEMA ---------------- */
const productSchema = new mongoose.Schema({
name: String,
price: Number,
category: String
});
const Product = mongoose.model("Product", productSchema);
/* ---------------- ROUTES ---------------- */
/* CREATE PRODUCT */
app.post("/products", async (req, res) => {
const product = new Product({
name: req.body.name,
price: req.body.price,
category: req.body.category
});
await product.save();
res.json(product);
});
/* GET PRODUCTS */
app.get("/products", async (req, res) => {
const products = await Product.find();
res.json(products);
});
/* UPDATE PRODUCT */
app.put("/products/:id", async (req, res) => {
const product = await Product.
Now you move from temporary data (arrays) β real database storage.
Backend apps must store data permanently.
That's where databases come in.
*π§ What is a Database*
A database stores data persistently.
*Examples:*
- E-commerce: Products, orders
- Social media: Users, posts
- Banking app: Transactions
*Without database β data disappears when server restarts.*
*π What is MongoDB*
MongoDB is a NoSQL database.
*Instead of tables β it stores documents (JSON-like data).*
*Example document:*
{
"name": "Deepak",
"role": "Developer",
"age": 25
}
*Collection = group of documents*
*Database = group of collections*
*π¦ Why MongoDB is Popular*
β *JSON-like data*
β *Flexible schema*
β *Works perfectly with JavaScript*
β *Scales easily*
*Common in MERN stack.*
*MERN = MongoDB + Express + React + Node*
*π Connecting MongoDB with Node.js*
We use a library called Mongoose.
*Install:*
npm install mongoose
*β‘ Step 1 β Connect Database*
*Example:*
const mongoose = require("mongoose");
mongoose.connect("mongodb://127.0.0.1:27017/myapp")
.then(() => console.log("MongoDB Connected"))
.catch(err => console.log(err));
*Now Node server is connected to MongoDB.*
*π§© Step 2 β Create Schema*
*Schema defines data structure.*
*Example:*
const userSchema = new mongoose.Schema({
name: String,
age: Number
});
*π Step 3 β Create Model*
*Model allows database operations.*
const User = mongoose.model("User", userSchema);
*β Step 4 β Create Data*
app.post("/users", async (req, res) => {
const user = new User({
name: req.body.name,
age: req.body.age
});
await user.save();
res.json(user);
});
*π Step 5 β Fetch Data*
app.get("/users", async (req, res) => {
const users = await User.find();
res.json(users);
});
*β Step 6 β Delete Data*
app.delete("/users/:id", async (req, res) => {
await User.findByIdAndDelete(req.params.id);
res.json({ message: "User deleted" });
});
*βοΈ Step 7 β Update Data*
app.put("/users/:id", async (req, res) => {
const user = await User.findByIdAndUpdate(
req.params.id,
req.body,
{ new: true }
);
res.json(user);
});
*π Full Backend Flow Now*
*React β API request*
*Express β Handles route*
*Mongoose β Talks to MongoDB*
*MongoDB β Stores data*
*β οΈ Common Beginner Mistakes*
- *Forgetting to install mongoose*
- *Not using async/await*
- *Wrong MongoDB URL*
- *Not validating schema*
*π§ͺ Mini Practice Task*
*Build Product API with MongoDB*
*Routes:*
- POST /products
- GET /products
- PUT /products/:id
- DELETE /products/:id
*Fields:*
name
price
category
β *Mini Practice Task β Solution*
This solution implements:
β POST /products β Add product
β GET /products β Fetch products
β PUT /products/:id β Update product
β DELETE /products/:id β Delete product
π’ *Step 1 β Install Required Packages*
npm init -y
npm install express mongoose cors
π *Step 2 β Create server.js*
const express = require("express");
const mongoose = require("mongoose");
const cors = require("cors");
const app = express();
app.use(cors());
app.use(express.json());
/* ---------------- DATABASE CONNECTION ---------------- */
mongoose.connect("mongodb://127.0.0.1:27017/productdb")
.then(() => console.log("MongoDB connected"))
.catch(err => console.log(err));
/* ---------------- PRODUCT SCHEMA ---------------- */
const productSchema = new mongoose.Schema({
name: String,
price: Number,
category: String
});
const Product = mongoose.model("Product", productSchema);
/* ---------------- ROUTES ---------------- */
/* CREATE PRODUCT */
app.post("/products", async (req, res) => {
const product = new Product({
name: req.body.name,
price: req.body.price,
category: req.body.category
});
await product.save();
res.json(product);
});
/* GET PRODUCTS */
app.get("/products", async (req, res) => {
const products = await Product.find();
res.json(products);
});
/* UPDATE PRODUCT */
app.put("/products/:id", async (req, res) => {
const product = await Product.