Use Endpoint Filters and Route Groups in Minimal APIs
ASP.NET Core Minimal APIs allow you to quickly create controller-less HTTP APIs with minimal dependencies. A minimal API typically has an endpoint URL and an endpoint handler. At times you want to intercept an endpoint handler so that you can add pre and post processing to the endpoint handler. That's where Endpoint Filters come into picture. When there are too many endpoints, it makes sense to group them using a common URL prefix. This is taken care by Route Groups. In this article we will examine both with a few examples.
https://www.binaryintellect.net/articles/7efeaba7-8881-4f29-98d0-13e2ceb0cb9c.aspx