route constraint
A rule inside a route template, such as :int in {id:int}, that a URL segment must satisfy for the route to match.
In more detail
A non-numeric identifier then gets 404 before your code runs. Constraints disambiguate routes; they are not a substitute for input validation.
Related terms
- routing — Choosing which piece of code handles a request, based on its method and path, such as GET /users/42.
- model binding — Turning parts of an HTTP request, such as route values, the query string, headers and the JSON body, into typed parameters for your handler.
Taught in
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- Building Routes with Minimal APIs — Modern .NET Core, C# & Enterprise Microservices
- Comparing Controllers and Minimal APIs — Modern .NET Core, C# & Enterprise Microservices