What is the difference between Express 4.x and Express 5.x?

Answer

Express 5.x (stable since 2024) introduces several important improvements: Async error handling: errors thrown in async route handlers are automatically passed to error-handling middleware without wrapping them manually in try/catch or asyncHandler. Removed deprecated features: req.param(), res.json(status, obj), and other Express 4 deprecations are removed. Router returns a Promise for awaiting route completion. Stricter regex routing: route parameters require explicit delimiters. Path-to-regexp upgrade changes some route matching behavior. Migration from 4 to 5 is mostly straightforward for most apps — the main work is removing deprecated API calls and testing async error propagation behavior.