Creating custom endpoints
The easiest way to create an endpoint is by using the lambda-based endpoints:
endpoints.Map("/map", async context =>
{
    await context.Response.WriteAsync("OK");
});
This maps the /map route to a simple endpoint that writes the word "OK" to the response stream.
You might need to add the Microsoft.AspNetCore.Http namespace to the using statements.
You can also map specific HTTP methods (such as GET, POST, PUT, and DELETE) to an endpoint. The following code shows how to map the GET and POST methods:
endpoints.MapGet("/mapget", async context =>
{
    await context.Response.WriteAsync("Map GET");
});
endpoints.MapPost("/mappost", async context =>
{
    await context.Response.WriteAsync("Map POST");
});
We can also map two or more HTTP methods to an endpoint:
endpoints.MapMethods( Â Â Â Â ...