There are a few options we can configure for route generation, all of which are configured through the AddRouting extension method over the services definition:
services.AddRouting(options =>
{
options.LowercaseUrls = true;
options.AppendTrailingSlash = true;
options.ConstraintMap.Add("evenint", typeof(EvenIntRouteConstraint));
});
The RouteOptions class supports the following properties:
- AppendTrailingSlash: Determines whether or not a trailing slash (/) should be appended to all generated URLs; the default is false (meaning it shouldn't)
- LowercaseUrls: Determines whether or not the generated URLs should be lowercase; the default is false
- ConstraintMap: Determines where constraints are mapped; more on this when we talk about route constraints
But route configuration does not end here—the next section is actually the most important one: Creating routing tables...