|
|
|
@ -25,6 +25,8 @@ namespace AspNetCoreApi |
|
|
|
|
app.UseSwaggerUI(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add Middlewares |
|
|
|
|
app.UseMiddleware<CustomMiddleware1>(); |
|
|
|
|
app.UseMiddleware<CustomMiddleware2>(); |
|
|
|
|
|
|
|
|
@ -32,6 +34,20 @@ namespace AspNetCoreApi |
|
|
|
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
|
|
app.UseRouting(); |
|
|
|
|
app.UseEndpoints(endpoints => |
|
|
|
|
{ |
|
|
|
|
endpoints.MapGet("/routingtest", async context => |
|
|
|
|
{ |
|
|
|
|
await context.Response.WriteAsync("Hello, World!"); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
endpoints.MapGet("/routingtest/hello/{name}", async context => |
|
|
|
|
{ |
|
|
|
|
var name = context.Request.RouteValues["name"]; |
|
|
|
|
await context.Response.WriteAsync($"Hello, {name}!"); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
app.MapControllers(); |
|
|
|
|
|
|
|
|
|