Express.js
Express.js is a minimalist and flexible web framework for the Node.js runtime that simplifies building HTTP servers, APIs and backend web applications. It is regarded as the de facto standard for building server-side applications in the JavaScript ecosystem and forms the basis of many popular technology stacks. Its strength is simplicity — it provides only the essential skeleton, leaving the developer free to choose the rest of the tooling.
How Express.js works
Express builds a convenient layer on top of the HTTP module built into Node.js, resting on two pillars:
- Routing — mapping HTTP methods (GET, POST, PUT, DELETE) and URL paths to the functions that handle requests, letting you clearly define how the server responds to each endpoint.
- Middleware — a chain of intermediary functions that every request passes through before reaching its final handler. Middleware is responsible for authentication, logging, parsing the request body, error handling and more.
This architecture makes an Express application a series of layers invoked in sequence, which you can compose freely. The framework imposes neither a project structure nor a database layer — the developer decides whether to plug in MongoDB, PostgreSQL or another solution.
Express.js in practice
Express is most often used to build REST APIs powering frontend and mobile apps, microservices and the server layer of single-page applications. To run an Express app in production you need a server with the Node.js runtime installed — usually a VPS or a dedicated server on which the application process runs continuously, typically behind a process manager and a proxy server.
Powiązane pojęcia
Najczęstsze pytania
How is Express.js different from Node.js?
Node.js is a runtime that lets you execute JavaScript on the server and provides low-level modules, including one for HTTP. Express.js is a library running on top of Node.js that adds a convenient layer over those modules: routing, middleware and request handling. Node is the foundation, Express is the layer that simplifies building a server.
