03: Request-Response Cycle in Express

Express.js, or simply Express, is a back end web application framework for building RESTful APIs with Node.js. Express was developed with an intention of making it pretty easy to rapidly develop backend project. Most backend projects are about writing codes that makes various requests to servers to request for different. A request in itself, is simply a set of predefined methods used for interacting with data stored on servers. Every request sent to a server includes an endpoint and the type of request being sent. You can see an endpoint as a gateway between two programsː the client and the server. The request cycle in express Js can therefor be seen as the cycle that involves how Express Js makes request calls to a data store, and how the data store in turn, gives feedback on the call that is made.
The Cycle goes like this :
Request >> Next Middleware>>Datastore>>Next Middleware>>Response
The request is simply just asking for server resources. Itself could be a set of methods intended to pull something from the data store.
The middleware Sits between the application and a request whose job basically screens access to the particular data requested for. It basically is a gateman between your machine and a network. It consists of controller>>Service>> Model or entity.
Response is basically the answer to a request.
This is simply the route a request takes before it gets a response.
Subscribe to my newsletter
Read articles from Onyeukwu Philemon directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
