projects/minimal-api/README.md
This is Hello World ASP.NET Core 6 app using the new WebApplication instead of IHostBuilder.
In these examples we are using the familiar Host.CreateDefaultBuilder(args) host configuration style to emphasis that the new Minimal Routing feature works in both existing style and also in the new minimal hosting API.
This is a brand new feature that allows the creation of Web API without using Controllers.
This sample shows how to access HttpContext in Map.
This sample shows how to access objects Map.
This sample shows how to setup Open API support using .NET 10 built-in OpenAPI.
This sample shows how to use HttpRequest directly without relying on HttpContext.
This sample shows the use of IEndPointRouteBuilder to organize code.
MapPost with JSON model binder
This sample shows how JSON model binder works in MapPost.
MapPost with JSON model binder - 2
This sample shows how JSON model binder works in MapPost using static method.
MapMethods with JSON model binder
This sample shows how to handle multiple HTTP Verbs request using MapMethods. In this example we send 'PUT', 'POST' and 'PATCH' requests.
Route Constraints - int, min, max and range
This example shows route constraint for integer, the minimum and maximum value, and the range.
Route Constraints - decimal, float and double
This example shows route constraint for decimal, float and double.
Link Generator - Generate path from a route name
This sample shows how to generate a url path from a route name.
This example shows usage of implicit route parameter binding of int and string types.
This example shows usage of explicit route parameter binding of int and string types using [FromRoute] attribute.
Query string binding - implicit
This example shows usage of implicit query string parameter binding of int and string types.
Query string binding - explicit
This example shows usage of explicit query string parameter binding of int and string types using '[FromQuery]' attribute.
This example shows usage of special types binding e.g. - HttpContext, HttpRequest, HttpResponse, CancellationToken, and ClaimsPrincipal.
This example shows usage of explicit header parameter binding of string type using '[FromHeader]' attribute.
This example shows usage of explicit json parameter.
This example shows usage of explicit json parameter binding using '[FromBody]' attribute.
Custom binding to types over Route, Query or Header
This example shows usage of custom binding to types over Route, Query or Header via implementation of static TryParse method.
This shows how to take full control of the binding process by implementing BindAsync static method in your type.
Antiforgery Token on HTML form
This shows how to use the IAntiforgery interface to generate a token for use in an HTML form.
Antiforgery Token on AJAX call
This shows how to use the IAntiforgery interface to generate a token for use in AJAX call.
This shows how to implement cross site antiforgery (e.g. the API is located in a different domain).
This sample shows how to apply an Endpoint filter to your minimal API.
This sample shows how to apply multiple Endpoint filters to your minimal APIs.
This examples shows the sequence of code execution before RouteHandlerFilterDelegate and after RouteHandlerFilterDelegate in multiple endpoint filters.
Use IStatusCodeHttpResult to detect return result in filter.
MapGroup() extension methods allow grouping of endpoints with a common prefix. It also allow group metadata to be attached to the group.
Use .WithTags(), .WithDescription(), .WithSummary() to enrich OpenAPI information for all the endpoints in the group. Uses .NET 10 built-in OpenAPI.
Use .ExcludeFromDescription to exclude endpoints from OpenAPI description. Uses .NET 10 built-in OpenAPI.
Minimal API Form Model Binding
This sample demonstrates the ability to use [FromForm] binding in Minimal API.
Microsoft.AspNetCore.Http.TypedResults static class is the “typed” equivalent of the existing Microsoft.AspNetCore.Http.Results class.
This sample demonstrates .NET 10 built-in OpenAPI support using XML comments and AddOpenApi().
Results<TResult1, TResult2, TResultN> provides better description of the result of the operation. Uses .NET 10 built-in OpenAPI.
This sample demonstrates the usage of IFormFile to upload a file in Minimal API.
This sample demonstrates the usage of IFormFileCollection to upload multiple files in Minimal API.
dotnet8