Middleware is a useful tool for developers dealing with cross-cutting concerns. This is because it intercepts and enhances every incoming request and outgoing response, and it can increase performance with early-return requests. Concepts from logging to authentication should be handled by using middleware. The topics covered in the chapter provided you with the necessary knowledge to understand the middleware-first approach taken by the ASP.NET Core framework. Furthermore, the chapter also gave an overview of the built-in middleware of ASP.NET Core, and it described how to create custom middleware.
In the next chapter, we will explore another core topic for increasing the maintainability and testability of our code: dependency injection. ASP.NET Core provides out-of-the-box dependency injection, and we will also explore how to solve dependencies and how to deal with different...