Express.js is the most popular Node.js web framework, with 60M+ weekly npm downloads. It powers backends at Uber, IBM, and Accenture.
What You Get for Free
- Minimal and flexible — unopinionated routing
- Middleware ecosystem — thousands of packages
- Template engines — EJS, Pug, Handlebars
- Static files — built-in serving
- Error handling — centralized error middleware
Hello World
const express = require('express');
const app = express();
app.get('/api/hello', (req, res) => {
res.json({ message: 'Hello World' });
});
app.listen(3000);
Middleware Pattern
app.use(express.json());
app.use((req, res, next) => {
console.log(req.method, req.url);
next();
});
Express vs Fastify
| Feature | Express | Fastify |
|---|---|---|
| Downloads | 60M/week | 5M/week |
| Speed | Good | 2x faster |
| Schema | Manual | Built-in |
Need Node.js backend help? Check my work on GitHub or email spinov001@gmail.com for consulting.
Top comments (0)