C
C#17mo ago
palapapa

❔ What does the "required" constraint do in route templates?

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-7.0#route-templates says the "required" constraint "Used to enforce that a non-parameter value is present during URL generation." I don't know what that means and can't seem to find any information about it.
Routing in ASP.NET Core
Discover how ASP.NET Core routing is responsible for matching HTTP requests and dispatching to executable endpoints.
3 Replies
phaseshift
phaseshift17mo ago
it means that something in the url before '?' must be present (parameters being the name/value things after "?")
palapapa
palapapaOP17mo ago
But you can just do {name} and it is still required?
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server