I'm new to Minimal API which is available in ASP.NET Core 6.0 and based on Microsoft's tutorials here and here, one can define a sample route for Get method like this:
app.MapGet("/", () => "Hello World!");
For the Post method, the following code is provided:
...
app.MapPost("/todoitems", async (Todo todo, TodoDb db) =>
{
db.Todos.Add(todo);
await db.SaveChangesAsync();
return Results.Created($"/todoitems/{todo.Id}", todo);
});
...
In other part of the overview, some Special types such as: HttpContext
, HttpRequest
, HttpResponse
, ... are introduced and it seems that they are injected as parameters to routing methods (Get, Post, ...); So all these parameters are available:
app.MapPost("/test", (HttpContext context, HttpRequest request, HttpResponse response) => "Hello world!");
My questions is: What other parameters are available here:
app.MapPost("/test", (**HERE???**) => "Hello World!") {};