Implement Middlewares Using Endpoint Routing in ASP.NET Core 3.0

If you have a middleware that needs to work on a specific path, you should implement it by mapping it to a route in ASP.NET Core 3.0, instead of just checking the path names. This post doesn’t handle regular middlewares, which need to work all request, or all requests inside a Map or MapWhen branch.
At the Global MVP Summit 2019 in Redmond I attended the hackathon where I worked on my GraphQL middlewares for ASP.NET Core. I asked Glen Condron for a review of the API and the way the middleware gets configured. He told me that we did it all right. We followed the proposed way to provide and configure an ASP.NET Core middleware. But he also told me that there is a new way in ASP.NET Core 3.0 to use this kind of middleware.