The Engineering Problem Express Tries to Solve
If you don’t know, we can also build an HTTP application using Node.js low-level HTTP APIs. The application is working properly and able to handle requests and generate responses. So, why do we need to build Express?
The reason behind that is that building an HTTP application using Node.js low-level HTTP APIs becomes repetitive and cumbersome (difficult) as the application grows. The repetition of writing code for request parsing, routing, middleware, and handling the logic becomes more complex.
The Problem Express Solves:
How can we build an HTTP application on top of Node.js without repeatedly implementing the same request parsing, routing, middleware, and response handling logic ourselves?
Express introduces reusable abstractions for those common problems. In application building, the repeated infrastructure, such as routing, middleware composition, request parsing, response handling, and error handling, is directly provided by those reusable abstractions.
If you are confused by reusable abstractions, don’t worry. It simply means a ready-made piece of code or concept that solves a common problem.
This reusable abstraction gives us the ability to write actual business logic instead of writing complex application infrastructure for every project.
This is the actual problem that Express tries to solve. And it exists to provide a higher-level abstraction over Node.js low-level HTTP APIs.
Top comments (0)