31 ms·
You can write a method that uses IEndpointRouteBuilder for creating a route group so that you can split up your routes by object domain or into separate classes
by conor- 3y ago
You can write a method that uses IEndpointRouteBuilder for creating a route group so that you can split up your routes by object domain or into separate classes or however you want to.
Then you add an extensions method for WebApplication that registers all of your route groups when configuring your app pipeline. Each time you create a new route group, you add that group to your WebApplication extension method and it's wired up.
It's a little extra work up-front when you're first creating your app, but it also results in a clearer structure for how routes are defined once the app grows into the size you're describing.