What is Express.js?
Answer
Express.js is the most popular, minimal, and flexible Node.js web application framework. It provides a thin layer of web application features on top of Node's built-in http module without obscuring Node.js features. Key features: (1) Routing — define route handlers for different HTTP methods and URL patterns: app.get("/users/:id", handler); (2) Middleware — chain functions that have access to request and response objects; (3) Template engines — integrates with EJS, Pug, Handlebars; (4) Static file serving — express.static(); (5) Error handling — centralized error-handling middleware with 4 parameters (err, req, res, next). Express is unopinionated — it imposes minimal structure, which makes it flexible but also means you choose your own patterns for things like authentication, database access, and validation. Alternatives include Fastify, Koa, Hapi, and NestJS.