Mohit Decodes
171 subscribers
68 photos
1 video
1 file
203 links
✨ Source Code for All Projects – Download & practice easily
πŸŽ“ Free Tutorials & Notes
πŸ› οΈ Coding Projects & Mini Apps
πŸ“Œ Subscribe on YouTube: Mohit Decodes πŸ””
πŸ“© For business inquiries: @MohitChoudhary0007
Download Telegram
Now, let's move to the next topic in Web Development Roadmap:

🌐 *Backend Basics β€” Node.js & Express*

Now you move from frontend (React) β†’ backend (server side).

Frontend = UI, Backend = Logic + Database + APIs.

🟒 *What is Node.js* ❓
- Node.js is a JavaScript runtime that runs outside the browser.
- Built on Chrome V8 engine, allows JavaScript to run on server.

🧠 *Why Node.js is Popular*
- Same language (JS) for frontend + backend
- Fast and lightweight
- Large ecosystem (npm)
- Used in real companies

⚑ *How Node.js Works*
- Single-threaded, event-driven, non-blocking I/O
- Handles many requests efficiently, good for APIs, real-time apps, chat apps

*πŸ“¦ What is npm*
- npm = Node Package Manager
- Used to install libraries, manage dependencies, run scripts

Example: npm install express

πŸš€ *What is Express.js* ❓
- Express is a minimal web framework for Node.js.
- Makes backend development easy, clean routing, easy API creation, middleware support

*🧩 Basic Express Server Example*
- Install Express: npm init -y, npm install express
- Create server.js:
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("Hello Backend");
});
app.listen(3000, () => {
console.log("Server running on port 3000");
});
- Creates server, handles GET request, sends response, listens on port 3000

*πŸ”„ What is an API*
- API = Application Programming Interface
- Frontend talks to backend using APIs, usually in JSON format

*🧠 Common HTTP Methods (Backend)*
- GET: Fetch data
- POST: Send data
- PUT: Update data
- DELETE: Remove data

*⚠️ Common Beginner Mistakes*
- Forgetting to install express
- Not using correct port
- Not sending response
- Confusing frontend and backend

*πŸ§ͺ Mini Practice Task*
- Create basic Express server
- Create route /about
- Create route /api/user returning JSON
- Start server and test in browser

βœ… *Mini Practice Task – Solution* 🌐

*🟒 Step 1️⃣ Install Express*
Open terminal inside project folder:
npm init -y
npm install express

βœ” Creates package.json
βœ” Installs Express framework

πŸ“„ *Step 2️⃣ Create server.js*

Create a file named server.js and add:

const express = require("express");
const app = express();

// Home route
app.get("/", (req, res) => {
res.send("Welcome to my server");
});

// About route
app.get("/about", (req, res) => {
res.send("This is About Page");
});

// API route returning JSON
app.get("/api/user", (req, res) => {
res.json({ name: "Deepak", role: "Developer", age: 25 });
});

// Start server
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});

*▢️ Step 3️⃣ Start the Server*
Run in terminal:
node server.js

You should see: Server running on http://localhost:3000

*🌍 Step 4️⃣ Test in Browser*
Open these URLs:
- http://localhost:3000/ β†’ Welcome message
- http://localhost:3000/about β†’ About page text
- http://localhost:3000/api/user β†’ JSON response

*Double Tap β™₯️ For More*
❀2
Angular 21 Full Course in Hindi 2026 | 12 Hour Beginner to Advanced + 4 Projects
https://youtu.be/S2yJRqtnM7Y
❀1
*10 Essential Javascript Concepts You Should Know*:

*1️⃣ Variables (`let`, const, `var`)*
- *`let`*: Block-scoped, used for values that can change.
- *`const`*: Block-scoped, used for values that shouldn’t change.
- *`var`*: Function-scoped (older, avoid in modern JS).
let name = "John";
const age = 25;
var city = "Delhi";

*Real-life analogy*: A const is like your birthdate β€” it never changes. A let is your location β€” it may change.

*2️⃣ Data Types*
- *Number*: 10, 3.14
- *String*: "Hello"
- *Boolean*: true, false
- *Null*: intentionally empty
- *Undefined*: declared but no value yet
- *Object*: { key: value }
- *Array*: [item1, item2]
let items = ["pen", "book"];
let user = null;

*3️⃣ Functions*
Functions group code that you can reuse. They accept inputs (parameters) and return outputs.
function greet(name) {
return `Hello ${name}`;
}
greet("Amit"); // "Hello Amit"

*4️⃣ Conditionals*
Used to make decisions based on logic.
let marks = 80;
if (marks >= 50) {
console.log("Pass");
} else {
console.log("Fail");
}

Also includes switch for multiple conditions.


*5️⃣ Loops*
Used for repeating tasks (e.g., processing every item in a list).

β€œ`js
for (let i = 0; i < 3; i++)
console.log(i); // 0,1,2
β€œ`

*6️⃣ Arrays Methods*
Arrays hold multiple values. Common methods:
- push(), pop(): Add/remove
- length: Size
- forEach(), map(), filter(): Iterate/transform
let fruits = ["apple", "banana"];
fruits.push("mango");

*7️⃣ Objects*
Objects group data in key-value form.
let car = 
brand: "Toyota",
year: 2020
;
console.log(car.brand); // Toyota


*8️⃣ Events*
Used to interact with users (click, input, etc.).
document.getElementById("btn").addEventListener("click", () => 
alert("Button clicked!");
);


*9️⃣ DOM Manipulation*
DOM = HTML elements. JS can read or update them.
document.getElementById("title").innerText = "Updated Text";


*πŸ”Ÿ ES6 Features*
Modern additions to JS:
- *Arrow functions*: Cleaner syntax
- *Destructuring*: Extract values easily
- *Template literals*: {} inside strings
- *Spread/Rest*: Copy or merge arrays/objects
const add = (a, b) => a + b;
const { brand } = car;

*React ❀️ if this helped you!*
❀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:
/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
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
❀2
React Developer Mock Interview | 2+ Years Experience | Real Interview Questions
https://youtu.be/f_Gm0vTains
πŸ‘1