mina shaker

mina shaker

  • 1.6k
  • 122
  • 6.5k

dose using the App.Map() considerd endpoin or a middlewear?

Sep 13 2024 5:45 PM

if i used below dose this considered a middlewear or a endpoint ,and dose middlewears only created using Use() and Run() 

app.Map("/" ,async context => await context.Response.WriteAsync("Hello World") )

and alos i want to ask why dose the Use in this code invoked before the Map()

app.UseRouting();

app.Use(async (context, next) =>
{
    await context.Response.WriteAsync(MyCustomKeyValue + '\n');
    await next();
    await context.Response.WriteAsync("The Value Appers there" + '\n');
});

app.Map("/", async (context) =>
{
    await context.Response.WriteAsync("From Route /" + '\n');
});

Answers (1)