Day 12 – Node.js Handling Routes Without Express Today I implemented basic routing using the built-in http module. By checking req.url, we can manually handle different routes and send appropriate responses. This helps understand how routing works internally before using frameworks like Express. Next: Understanding HTTP methods (GET, POST, etc.) #NodeJS #BackendDevelopment #JavaScript #WebServer #SoftwareEngineering
Node.js Routing with http Module
More Relevant Posts
-
Day 13 – Node.js Understanding HTTP Methods Today I implemented basic handling of HTTP methods using the built-in http module. By checking req.method, we can differentiate between GET and POST requests. Understanding this is essential before moving to REST APIs and Express. Next: Handling POST request body in pure Node.js. #NodeJS #BackendDevelopment #JavaScript #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
Today Class was on Internals of Node.js! Understood how Node.js runs on a single main thread, uses the event loop to handle async tasks, and a thread pool (default 4 threads) for heavy operations. Also learned how phases like I/O polling, expired callbacks, and setImmediate work behind the scenes. Really interesting to see how Node.js executes code internally. #NodeJS #NodeJSInternals #JavaScript #EventLoop #ChaiCohort26 #Chaicode Hitesh Choudhary Chai Code #piyushgarg Anirudh Jwala Akash Kadlag Jay Kadlag JavaScript
To view or add a comment, sign in
-
-
Schema validation is a critical part of building secure and reliable APIs. Here’s a side-by-side comparison of Express Validator, Joi, and Zod with practical examples to help you understand the differences in syntax and structure. Which one do you prefer in your Node.js projects — Express Validator, Joi, or Zod? #NodeJS #BackendDevelopment #JavaScript #WebDevelopment #APIs
To view or add a comment, sign in
-
-
💡Difference Between State and Props in React 👉 Props → Passed from parent to child (read-only) 👉 State → Managed inside the component (mutable) Simple rule I follow : Props = external data State = internal data Understanding this made React much clearer for me 👆 #reactjs #javascript #frontenddeveloper #webdevelopment
To view or add a comment, sign in
-
🚀 Day 23 - Poll answer & Explanation 💡 **JavaScript Event Loop Explained (Simple & Clear)** ```javascript console.log('S'); Promise.resolve().then(() => console.log('P1')); setTimeout(() => console.log('T1'), 0); Promise.resolve().then(() => console.log('P2')); setTimeout(() => console.log('T2'), 0); console.log('E'); Output: S E P1 P2 T1 T2 ``` 🔹 **Explanation:** * `S` and `E` run first → synchronous code (call stack) * `P1`, `P2` → microtasks (Promises) → run next * `T1`, `T2` → macrotasks (setTimeout) → run last 👉 Microtasks always execute before macrotasks in the event loop. #JavaScript #ReactJS #WebDevelopment #Coding #FrontendDeveloper #InterviewPrep
To view or add a comment, sign in
-
🔗 Understanding Node.js Modules Modules help you split your code into reusable pieces. Use require() to import modules and module.exports to share functionality. It’s a simple but powerful way to keep your code clean and maintainable. #NodeJS #Modules #JavaScript #CleanCode #BackendDevelopment
To view or add a comment, sign in
-
React 19 makes refs simple One of the most awkward React APIs is finally cleaned up. Earlier, passing refs meant: - forwardRef boilerplate - TypeScript generic issues - Extra wrapper components import { forwardRef } from "react"; const Input = forwardRef(function Input(props, ref) { return <input ref={ref} {...props} />; }); With React 19, ref is just a regular prop. function Input({ ref, ...props }) { return <input ref={ref} {...props} /> } - No forwardRef - No HOC - Just clean, predictable React A small change that significantly improves developer experience, especially for reusable component libraries in React. #React19 #FrontendEngineering #JavaScript #TypeScript #DeveloperExperience
To view or add a comment, sign in
-
🧠 JavaScript Async/Await Challenge What will be the output? async function test() { console.log("1"); await Promise.resolve(); console.log("2"); } console.log("3"); test(); console.log("4"); Options: A) 3 1 2 4 B) 3 1 4 2 C) 1 3 4 2 D) 3 4 1 2 What do you think the output will be? 👀 #javascript #frontenddeveloper #webdevelopment #codingchallenge
To view or add a comment, sign in
-
🚀 What I Learned Today: Node.js Internals • Node.js runs JavaScript on a single main thread • Top-level code executes first before the event loop starts • Import statements load during initialization • Event Loop manages asynchronous operations Event Loop Phases: • Timers → setTimeout() / setInterval() • I/O Polling → file system & network operations • Check → setImmediate() (Node.js specific) • Close Callbacks → cleanup tasks • Node.js uses a libuv worker thread pool (default: 4 threads) • Thread pool size can be changed using process.env.UV_THREADPOOL_SIZE https://lnkd.in/gwFG5WVW thank you Piyush Garg sir Hitesh Choudhary sir Akash Kadlag sir #chaiaurcode #NodeJS #JavaScript #Backend #EventLoop
To view or add a comment, sign in
-
-
⏳ “JavaScript is single-threaded.” I used to hear this everywhere. But then I had one question: If JavaScript is single-threaded… How does async code work? That’s when I learned about the Event Loop. Here’s the simple idea 👇 🧠 JavaScript has: • Call Stack • Web APIs • Callback Queue • Event Loop When async code runs (like setTimeout or fetch): 1️⃣ It moves to Web APIs 2️⃣ Once completed, it goes to the Callback Queue 3️⃣ The Event Loop checks if the call stack is empty 4️⃣ Then pushes it back to execute That’s why: console.log(1) setTimeout(() => console.log(2), 0) console.log(3) Output is: 1 3 2 Understanding this made debugging async bugs much easier. Frameworks don’t hide this. They rely on it. #JavaScript #EventLoop #WebDevelopment #FrontendDeveloper #NodeJS #SheryiansCodingSchool
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development