Express.js Interview Questions
Check out 30 of the most common Express.js interview questions and take an AI-powered practice interview
What is Express.js and why is it so widely used with Node.js?
How do you create a basic Express server and define routes?
What is middleware in Express and how is it different from a route handler?
How do you handle path parameters and query strings in Express?
What does `app.use()` do in Express?
What's the difference between `res.send()`, `res.json()`, and `res.end()`?
How do you serve static files in Express?
What is the Express Router and why would you use it?
How do you read the request body in Express?
What is CORS and how do you enable it in Express?
How does Express match routes when there's an overlap?
What is the difference between `next()` and `next(err)`?
Why does Express error-handling middleware need exactly four arguments?
How does Express 5 handle async errors differently from Express 4?
How do you implement JWT-based authentication in Express?
How do you secure an Express app for production?
What is the full request/response lifecycle in Express?
How do you implement role-based access control (RBAC) in Express?
How do you log Express requests in production?
What is `app.locals` vs `res.locals` in Express?
How do you handle file uploads in Express?
How do you write unit and integration tests for Express apps?
How do you implement rate limiting in Express?
What is `next('route')` and when would you use it?
How do you handle 404 (not found) errors cleanly in Express?
How do you scale an Express app across multiple CPU cores using clustering or PM2?
How do you profile and optimize a slow Express endpoint in production?
How would you architect an Express microservice for 10,000+ requests per second?
How do you implement graceful shutdown in an Express app?
When should you migrate from Express to NestJS, Fastify, or Hono?
Frequently Asked Questions
Is Express still relevant in 2026 with Fastify and Hono around?
Yes — Express still has the largest middleware ecosystem on npm, is the framework most Node.js developers learn first, and runs the vast majority of Indian production APIs in 2026 (Razorpay, Swiggy, Flipkart's developer-facing services, Postman). Fastify and Hono are faster on benchmarks, but the framework is almost never the bottleneck — your database is. Express 5's native async support closed the biggest historical gap. For most teams in India, Express is the safe default; consider alternatives only after profiling shows the framework is the limit. Even at companies that have migrated parts of their stack to NestJS or Fastify, Express still powers internal tools, admin dashboards, and legacy services — so knowing it deeply is non-negotiable for any Node.js backend role in 2026.
What does an Express.js / MERN developer earn in India?
₹6-20 LPA in 2026 for Node.js/Express backend developers, depending on experience. Freshers from bootcamps with strong MERN portfolios land at ₹4-7 LPA; mid-level (3-5 years) at ₹10-16 LPA; seniors (5+ years) at ₹15-25 LPA. Top-paying companies for Express engineers: Razorpay, Swiggy, Postman, Uber India, Flipkart, CRED. FAANG-equivalent compensation in India (Google, Microsoft) is higher but rarely uses Express specifically — they have internal stacks. Remote-first international companies pay 1.5-2x what Indian companies pay for the same skill set; a senior Node.js engineer at a US-headquartered company hiring from India typically lands ₹35-60 LPA.
Should I learn Express 4 or Express 5 in 2026?
Start with Express 5 — the syntax is 99% the same as 4, and you avoid teaching yourself the async-error workaround patterns that Express 5 makes obsolete. However, when you join a company, expect to see Express 4 in their production codebase (most teams haven't migrated yet). Know both: build new projects on 5, but be ready to debug 4 in any role. Specifically know: how to write async error wrappers in 4, what changed with the path matcher in 5, and why `req.param()` was removed.
What's the best way to structure a large Express project?
Feature-based folder structure: `routes/`, `controllers/`, `services/`, `models/`, `middleware/`, `validators/`, with each feature (users, orders, payments) split across these layers. Use Express `Router()` per feature module and mount them on the main app. Keep route handlers thin — they should parse input, call a service function, and return the response. Business logic lives in services, not in route handlers. For very large codebases (100+ developers), consider NestJS — it forces this separation via decorators and modules. A pattern that works well in mid-size codebases (10-30 engineers): one feature folder per domain (`features/users/`), with the route, controller, service, validator, and tests co-located.
How is Express different from Next.js API routes?
Next.js API routes are file-based, framework-agnostic, and tied to Next.js's runtime — each file becomes a route. They're great for full-stack apps where the frontend and API ship together (the goodspace.ai webapp uses this pattern). Express is a standalone framework you run as a separate Node process — better for dedicated backend services, microservices, or cases where the API is consumed by multiple frontends (web, mobile, partners). In modern stacks, teams often use both: Next.js API routes for frontend-coupled endpoints, separate Express services for heavy backend work. Next.js API routes also support edge runtimes (Cloudflare Workers, Vercel Edge) for ultra-low-latency responses — something Express can't do natively because it depends on Node's `http` module.
Do I need to learn TypeScript for an Express job in India?
Increasingly, yes. As of 2026, roughly 70% of new Indian Node.js job postings list TypeScript as required or strongly preferred. Most production Express codebases at Razorpay, Swiggy, and Postman are TypeScript. Learn JS first (the runtime semantics matter), then layer TypeScript on top. The Express types (`@types/express`) are mature and well-documented, and tools like `ts-node` / `tsx` make the dev loop fast. Common TypeScript patterns with Express you should know: module augmentation to type `req.user`, generic `Request<Params, ResBody, ReqBody, ReqQuery>` for typed handlers, and using `zod` + `z.infer<>` to derive both runtime validation and TypeScript types from a single schema.
Introduction
Express.js remains the dominant Node.js web framework in 2026 and is the default backend layer for the MERN stack that powers nearly every Indian bootcamp curriculum. Despite the rise of NestJS, Fastify, and Hono, the majority of Node.js production APIs in India — from Razorpay's developer portal to Swiggy's internal services to Postman's collaborative APIs — still run on Express because of its minimalism, ecosystem maturity, and the millions of engineer-hours invested in middleware libraries. If you're applying for a backend role at any company hiring Node.js engineers today, Express is non-negotiable knowledge.
Express 5.0 finally shipped in October 2024 after nearly a decade in beta, bringing native async/await error handling, modern router internals, and breaking changes to a few common patterns. If you're interviewing in 2026, expect deep questions on the middleware pipeline, error-handling middleware (the famous four-argument signature), the request/response lifecycle, async error swallowing in Express 4 vs 5, route ordering pitfalls, and the security stack (helmet, cors, express-rate-limit, express-validator). Senior roles also test on production concerns: clustering with PM2, graceful shutdown, observability, and scaling Express services past 10k RPS.
This guide walks through the 30 most-asked Express.js interview questions in India for 2026, grouped by difficulty (12 basic, 13 intermediate, 5 advanced). Each answer focuses on the underlying mechanics, real-world gotchas you'll hit in production, and code examples taken from patterns used by companies hiring Node.js engineers today. We've prioritized the questions you'll actually be asked over textbook definitions — the goal is to leave you ready to discuss Express fluently in an interview, not to recite the docs.