Web applications are everywhere. We use them for shopping, connecting with friends and family, and even for learning. Every time we perform an action in a web application, we are generating a request. When we put an item in our shopping cart on Amazon, we’re making a request. When we click on our friend’s profile, we’re requesting information from the web application. Clicking the button to get us to the next exercise? You guessed it, that’s us sending a request to the web app too.
Some web applications literally receive millions of requests per day. With so many incoming requests, how does the application know where to send each request and ultimately, how to provide the appropriate response? The ability to respond to our requests is at the core of web applications providing user interaction.
Contrary to what we may believe, web applications are not a magical box. Web requests do not disappear inside only to miraculously emerge with the requested information. Truth is, web applications use a series of components to route each request to its destination and then return an appropriate response to the user. This series of components is organized in a pipeline which is collectively known as middleware.
Middleware is essential to web applications because it is responsible for processing each request, routing each request, and responding accordingly. In this lesson, we will talk about how components get added to the pipeline and configuring the pipeline.
Instructions
In the sample website GIF, notice how clicking the link for the Contact page generates an HTTP request which gets passed through the middleware pipeline to the appropriate destination. Also, notice how the response to the HTTP request travels through the pipeline in reverse order to return the requested page.