From 6480c3ce5b38d49993b31737812e3b9a705958e7 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Mon, 24 Oct 2022 15:48:35 -0700 Subject: [PATCH 1/2] add route groups section --- aspnetcore/fundamentals/minimal-apis.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aspnetcore/fundamentals/minimal-apis.md b/aspnetcore/fundamentals/minimal-apis.md index 8f74adbe9497..da77a81655e4 100644 --- a/aspnetcore/fundamentals/minimal-apis.md +++ b/aspnetcore/fundamentals/minimal-apis.md @@ -4,7 +4,7 @@ author: rick-anderson description: Provides an overview of minimal APIs in ASP.NET Core ms.author: riande monikerRange: '>= aspnetcore-6.0' -ms.date: 08/23/2022 +ms.date: 10/24/2022 uid: fundamentals/minimal-apis --- @@ -1161,6 +1161,22 @@ The following table demonstrates the preceding route templates and their behavio For more information, see [Route constraint reference](xref:fundamentals/routing) in . +### Route groups + +The extension method helps organize groups of endpoints with a common prefix. It reduces repetitive code and allows for customizing entire groups of endpoints with a single call to methods like and . + +For example, the following code creates two similar groups of endpoints: + +:::code language="csharp" source="~/fundamentals/minimal-apis/7.0-samples/todo-group2/Program.cs" id="mapgroup"::: + +:::code language="csharp" source="~/fundamentals/minimal-apis/7.0-samples/todo-group2/TodoEndpoints.cs" id="todoendpoints"::: + +Use a relative address for the `Location` header in the `201 Created` result: + +:::code language="csharp" source="~/fundamentals/minimal-apis/7.0-samples/todo-group2/TodoEndpoints.cs" id="create"::: + +Route groups also support nested groups and complex prefix patterns with route parameters and constraints. For information about present route group capabilities and plans for future enhancements, see GitHub issue [dotnet/aspnetcore #41433](https://github.com/dotnet/aspnetcore/issues/41433). + ### Parameter Binding Parameter binding is the process of converting request data into strongly typed parameters that are expressed by route handlers. A binding source determines where parameters are bound from. Binding sources can be explicit or inferred based on HTTP method and parameter type. From 6c99fd1caa503a23af5639ea90c30bdec1c87588 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Mon, 24 Oct 2022 16:59:57 -0700 Subject: [PATCH 2/2] tweak wording --- aspnetcore/fundamentals/minimal-apis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/fundamentals/minimal-apis.md b/aspnetcore/fundamentals/minimal-apis.md index da77a81655e4..4bfb00954578 100644 --- a/aspnetcore/fundamentals/minimal-apis.md +++ b/aspnetcore/fundamentals/minimal-apis.md @@ -1171,7 +1171,7 @@ For example, the following code creates two similar groups of endpoints: :::code language="csharp" source="~/fundamentals/minimal-apis/7.0-samples/todo-group2/TodoEndpoints.cs" id="todoendpoints"::: -Use a relative address for the `Location` header in the `201 Created` result: +In this scenario, you can use a relative address for the `Location` header in the `201 Created` result: :::code language="csharp" source="~/fundamentals/minimal-apis/7.0-samples/todo-group2/TodoEndpoints.cs" id="create":::