Express is a minimal web framework for Node—routing, middleware, and helpers on top of http.createServer. It is the most common starting point before Nest, Fastify, or Hono.
Conceptual Hello Express
import express from 'express';
const app = express();
app.get('/', (req, res) => {
res.send('Hello');
});
app.listen(3000);
Compared to raw http
| Raw http | Express |
|---|---|
| Manual URL parsing | app.get('/users/:id') |
| Manual body parsing | express.json() middleware |
| Manual status/headers | res.json(), res.status() |
Playground note
Express is not installed in the runner—study the API here, then scaffold locally with npm init and npm install express. The editor compares the same route with built-in http.
Important interview questions and answers
- Q: What problem does Express solve?
A: Repetitive HTTP plumbing—routing, middleware chains, content negotiation—so handlers focus on business logic. - Q: Express vs Fastify?
A: Fastify emphasizes performance and schema validation; Express has the largest tutorial/community footprint.
Self-check
- What sits underneath Express?
- What does
express.json()middleware do?
Interview prep
- What is middleware?
Functions with
(req, res, next)that run in order—auth, logging, body parsing—callingnext()passes control to the next layer.