diff --git a/AspNetCoreApi/Program.cs b/AspNetCoreApi/Program.cs index 94935ea..3847e83 100644 --- a/AspNetCoreApi/Program.cs +++ b/AspNetCoreApi/Program.cs @@ -25,6 +25,8 @@ namespace AspNetCoreApi app.UseSwaggerUI(); } + + // Add Middlewares app.UseMiddleware(); app.UseMiddleware(); @@ -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(); diff --git a/README.md b/README.md index b804bbc..c822632 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,6 @@ ### Learning ASP.NET Core and Blazor -- API Server \ No newline at end of file +- API Server + - Middleware + - Routing \ No newline at end of file