+91 991 786 8156
NEED HELP?Chat with us

Introduction to Express.js: Node.js Framework

Muhammad Fareed 2026-01-03 2 min read

Read Full Article

Introduction to Express.js: Node.js Framework

Node.js on its own gives you a raw `http` module — functional, but you'd end up manually parsing URLs, handling different HTTP methods, and reading request bodies for every single route. Express.js wraps all of that in a small, unopinionated layer that's become the de facto standard for building Node.js APIs.

Routing Made Simple

Express lets you define routes declaratively, matched by HTTP method and path:

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

app.get('/users/:id', (req, res) => { res.json({ id: req.params.id, name: 'Aditi' }); });

app.listen(3000);

The `:id` syntax automatically captures that part of the URL into `req.params.id` — no manual URL parsing required, something you'd otherwise have to write by hand with raw Node.

Middleware: Express's Most Powerful Concept

Middleware functions run between a request arriving and a response being sent — perfect for logging, authentication checks, or parsing request bodies.

app.use(express.json()); // parses JSON request bodies automatically

app.use((req, res, next) => { console.log(`${req.method} ${req.url}`); next(); // pass control to the next middleware or route });

This pattern — small, composable functions chained together — is why Express scales cleanly from a five-route prototype to a production API with dozens of routes and cross-cutting concerns like auth and rate-limiting.

Structuring a Real Express App

Production Express apps typically separate routes, controllers, and middleware into different files rather than putting everything in one file: a `routes/` folder defines URL patterns, `controllers/` contain the actual logic, and `middleware/` holds reusable functions like authentication checks.

This separation is exactly what we teach students to set up from day one in our full stack training — it's the difference between a toy project and a codebase a team can actually maintain.

Conclusion

Express.js doesn't try to be a heavyweight, opinionated framework — it stays close to raw Node.js while removing the tedious parts: routing, body parsing, and middleware chaining. That simplicity is exactly why it remains the most widely used Node.js framework, even with newer alternatives like Fastify and NestJS available.

Frequently Asked Questions

Is Express.js still relevant in 2026?

Yes. Despite newer frameworks like NestJS and Fastify gaining adoption, Express remains the most widely used Node.js framework, with the largest ecosystem of middleware and the most job postings requiring it.

Do I need to know Node.js before learning Express?

Yes. Express is a layer built on top of Node.js's core modules, so understanding how Node handles requests and the event loop makes Express's design far easier to follow.

What is middleware in Express, in simple terms?

Middleware is a function that runs during the request-response cycle, before your final route handler. It's used for tasks like logging, authentication, or parsing incoming data, and each middleware can either end the request or pass it along to the next one.

Written by Muhammad Fareed

Mentor at HiTech Mentor, helping students build practical, job-ready skills in software development.

⭐ Found this article helpful? Like and share it with your friends!

Book a Free Trial