app.MapGet( "/todos/{id:int}", [Authorize("AdminsOnly")](int id) => "This endpoint is for admins only");
app.MapGet( "/todos/{id:int}", [Authorize("AdminsOnly")](int id) { return "This endpoint is for admins only"); });
app.MapGet("/todos/{id:int}", GetTodos); [Authorize("AdminsOnly"] string GetTodos(int id) => "This endpoint is for admins only";
You could also put these methods in a class and put the attribute on the class, which would solve your "grouping" problem.
You could also put these methods in a class and put the attribute on the class, which would solve your "grouping" problem.