projects/endpoint-routing/README.md
ASP.NET Core 3 allows more control on how to organize your endpoints using app.UseEndpoints. In this example, we just map Razor Pages routes and nothing else.
ASP.NET Core 3 allows more control on how to organize your endpoints using app.UseEndpoints. In this example, we just map MVC routes (attribute routing only, not convention routing) and nothing else.
Endpoint Routing - MVC with default route
Map MVC routes with default {controller=Home}/{action=Index}/{id?} set up.
Endpoint Routing - RequestDelegate
This example shows how to use RequestDelegate directly in app.UseEndpoints for GET operation using MapGet. MapPost, MapPut, and MapDelete are also available for use.
This allow the creation of very minimalistic web services apps.
Endpoint Routing - RequestDelegate
This example shows how to use RequestDelegate directly in app.UseEndpoints using Map.
Endpoint Routing - Interrogate available endpoints
This example shows how to list all available endpoints in your app.
Endpoint Routing - RequestDelegate with HTTP verb filter
This example shows how to use RequestDelegate directly in app.UseEndpoints using MapMethods that filter request based on one or more HTTP verbs.
Endpoint Routing - Static file fallback
Return a static page when your request does not match anything else using MapFallbackToFile.
Endpoint Routing - Razor Page fallback
Return a Razor Page when your request does not match anything else using MapFallbackToPage.
Endpoint Routing - Obtaining an Endpoint from your Middleware
Use the brand new HttpContext.GetEndPoint extension method to examine the current endpoint that is being executed.
Endpoint Routing - How to obtain metadata in an Endpoint from a Razor page
Use the brand new EndPoint.Metadata.GetMetadata<>() to get values from attributes at your Razor Page.
Unlike in MVC, you can't use Attribute from the method of a Razor Page. You can only use it from the Model class. This makes getting obtaining the appropriate metadata for each request require an extra step.
Endpoint Routing - Obtaining an Endpoint metadata from your MVC Controller
Obtain Endpoint metadata from MVC Controller's Action methods.
Endpoint Routing - Obtaining Endpoint feature via IEndpointFeature
Use HttpContext.Features.Get<IEndpointFeature>(); to obtain Endpoint information for a given Middleware. You can accomplish the same thing using HttpContext.GetEndpoint.
Endpoint Routing - Attaching Metadata information to your inline Middleware
Use IEndpointConventionBuilder.WithMetadata to attach metadata information to your inline Middleware.
Endpoint Routing - Map Areas by Convention
Use IEndpointRouteBuilder.MapAreaControllerRoute to configure routing for your areas.
Endpoint Routing - enable MVC but without Views support
Use services.AddControllers to provide MVC without Views supports. Razor Pages is not available. Perfect for Web APIs.
Endpoint Routing - enable MVC but with Views support but without Razor Page
Use services.AddControllersWithViews(); to provide MVC with Views supports. Razor Page is not available. So this similar to the "classic" MVC configuration.
Endpoint Routing - enable Razor Pages with MVC API support
Use services.AddRazorPages() add supports for Razor Pages and MVC API.
Endpoint Routing - Convention based Routing
Use IEndpointRouteBuilder.MapControllerRoute to configure convention based routing.
Endpoint Routing - A new way to map health check
Use IEndpointRouteBuilder.MapHealthChecks to configure health check instead of IApplicationBuilder.UseHealthChecks.
Endpoint Routing - Configure Endpoints default on Kestrel
We configure KestrelServerOptions.ConfigureEndpointDefaults so the Endpoints will run only on HTTP/2.
Endpoint Routing - Host Matching
This example demonstrates on how to configure your endpoint to respond to a request from a specific host. In this example, GET / returns a different result depending whether you access it from localhost:8111 and localhost:8112.
Endpoint Routing - Host Matching 2
This produces the same exact effect as the previous example above - Host Matching except that here we use IEndpointConventionBuilder.WithMetadata and HostAttribute instead of IEndpointConventionBuilder.RequireHost.
Endpoint Routing - Handle MVC routing dynamically
This example shows how to handle MVC routing dynamically using MapDynamicControllerRoute and DynamicRouteValueTransformer.
Endpoint Routing - Handle Razor Pages routing dynamically
This example shows how to handle Razor Pages routing dynamically using MapDynamicPageRoute and DynamicRouteValueTransformer.
Endpoint Routing - Setup to Razor Pages areas
This example shows how to create Razor Pages areas.
Endpoint Routing - Map a route to a Razor Pages in an area
Map a route to a Razor Pages located in an Area using Conventions.AddAreaPageRoute.
Endpoint routing - setup a fallback page in a Razor Pages area
This sample shows you how to setup a fallback page located in a Razor Pages area.
Endpoint routing - serve different fallback pages depending on route pattern match
This sample shows how to return different fallback page located in areas depending on the route pattern that matches the request.
Endpoint routing - anonymous access and authorization
Allow anonymous access and require authorization to endpoints.
Use Parameter Transformer to control the creation of route token [area], [controller] and [action]. In this example we use it on [controller] and [action].
dotnet8