main
Peace 11 months ago
parent 37f5386023
commit 8dc81a7971
  1. 16
      AspNetCoreApi/Program.cs
  2. 4
      README.md

@ -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();

@ -3,4 +3,6 @@
### Learning ASP.NET Core and Blazor
- API Server
- API Server
- Middleware
- Routing
Loading…
Cancel
Save