In this hour, you learned how to install and implement your own custom middleware. We discussed how middleware applications are basically just hooks into the request and response processors. You learned that you can define four types of functions in a middleware application.
The process_request() and process_view() functions are prehooks that are run before the URL is processed and the view functions are called, respectively. The process_response() and process_exception() functions are posthooks that are run just before the response is sent to the browser.
Implementing middleware allows you to customize the request and response handling in a variety of ways. For instance, you can make global changes to all requests and responses.