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