define route pattern asp core code example
Example 1: route attribute controller with parameter asp.net core
[Route("/api/v1/{foo}")]
public class MyController : Controller
{
public async Task<IActionResult> MyEndpoint(int foo) { }
}
Example 2: change dot net core web api routing
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});