Express 4 → Express 5
mediumExpress 5 reached GA after years of beta. Improved async error handling, removed deprecated methods, and updated path matching. Migration is mostly mechanical.
Estimated: 3-6h · 5 steps
Progress0%
Step 1: Update Express
npm install express@5
Step 2: Fix removed methods
res.json(status, obj) → res.status(status).json(obj). app.del() → app.delete(). req.host now excludes port.
Step 3: Update path patterns
Regex in route paths changed. Optional params /:id? now require explicit syntax. Wildcard * must be named: /*splat.
Step 4: Add async error handling
Express 5 auto-catches rejected promises in route handlers. Remove try/catch + next(err) patterns if desired.
Step 5: Test routes
✓ All routes respond correctly. Error middleware catches both sync and async errors.