Middleware
Middleware
Section titled โMiddlewareโvar builder = WebApplication.CreateBuilder(args);var app = builder.Build();
app.Use(async (ctx, next) => { Console.WriteLine($"Path: {ctx.Request.Path}"); await next();});
app.Run(async ctx => await ctx.Response.WriteAsync("Hello"));
app.Run();
Notes
- Order matters; configure from most general to most specific.