You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
routef "/bar/%O" (fun guid -> text (guid.ToString()))
@@ -1104,7 +1102,7 @@ let webApp =
1104
1102
1105
1103
The `routef` http handler takes two parameters - a format string and an `HttpHandler` function.
1106
1104
1107
-
The format string supports the following format chars, and now also supports **named parameters** using the syntax `%c:name` (e.g. `%i:petId`):
1105
+
The format string supports the following format chars:
1108
1106
1109
1107
| Format Char | Type |
1110
1108
| ----------- | ---- |
@@ -1117,7 +1115,11 @@ The format string supports the following format chars, and now also supports **n
1117
1115
|`%O`|`Guid` (including short GUIDs*) |
1118
1116
|`%u`|`uint64` (formatted as a short ID*) |
1119
1117
1120
-
**Named parameters**: You can use `%c:name` to assign a name to a route parameter, which is especially useful for OpenAPI/Swagger documentation and for clarity. For example, `routef "/pet/%i:petId"` will match `/pet/42` and bind `petId` to `42`.
1118
+
**Named parameters**: When using ASP.NET Core’s [Endpoint Routing](#endpoint-routing) with Giraffe, you can use `%<type>:<name>` (e.g., `%i:petId`) to assign a name to a route parameter, which is especially useful for OpenAPI/Swagger documentation and for clarity.
1119
+
1120
+
For example, the route `routef "/pet/%i:petId"` will match `/pet/42` and bind `42` to `petId`.
1121
+
1122
+
If you'd like to see an example, check the [EndpointRoutingApp sample](https://github.com/giraffe-fsharp/Giraffe/blob/master/samples/EndpointRoutingApp/Program.fs) at the official repository.
1121
1123
1122
1124
*) Please note that the `%O` and `%u` format characters also support URL friendly short GUIDs and IDs.
0 commit comments