@@ -57,7 +57,7 @@ public partial class GreetingWebApiEndpoint
5757
5858## Easy setup
5959- [x] Add the [ NuGet package] ( https://www.nuget.org/packages/futurum.webapiendpoint.micro ) ( futurum.webapiendpoint.micro ) to your project
60- - [x] Update * program.cs* as per [ here] ( #programcs )
60+ - [x] Update * program.cs* as per [ here] ( #example- programcs )
6161
6262### Example program.cs
6363``` csharp
@@ -113,9 +113,11 @@ app.UseWebApiEndpointsOpenApi();
113113You can * map* your minimal apis for this WebApiEndpoint in the * Build* method.
114114
115115The * IEndpointRouteBuilder* parameter is already:
116+ - configured with [ configuring for the entire API] ( #configuring-the-entire-api )
116117- configured with the API versioning
117- - configured with the route prefix
118- - been through the * optional* * Configure* method in the same class
118+ - configured with [ configuring a specific API version] ( #configuring-a-specific-api-version )
119+ - configured with the route prefix and tag
120+ - been through the * optional* * [ Configure] ( #configure ) * method in the same class
119121
120122``` csharp
121123protected override void Build (IEndpointRouteBuilder builder )
@@ -185,6 +187,31 @@ protected override RouteGroupBuilder Configure(RouteGroupBuilder groupBuilder, W
185187}
186188```
187189
190+ ##### Full example
191+ ###### RateLimiting
192+ ``` csharp
193+ [WebApiEndpoint (" rate-limiting" )]
194+ public partial class RateLimitingWebApiEndpoint
195+ {
196+ protected override RouteGroupBuilder Configure (RouteGroupBuilder groupBuilder , WebApiEndpointVersion webApiEndpointVersion )
197+ {
198+ return groupBuilder .RequireRateLimiting (RateLimiting .SlidingWindow .Policy );
199+ }
200+
201+ protected override void Build (IEndpointRouteBuilder builder )
202+ {
203+ builder .MapGet (" /" , GetHandler );
204+ }
205+
206+ private static Ok <DataCollectionDto <FeatureDto >> GetHandler (HttpContext context ) =>
207+ Enumerable .Range (0 , 10 )
208+ .Select (i => new Feature ($" Name - {i }" ))
209+ .Select (FeatureMapper .Map )
210+ .ToDataCollectionDto ()
211+ .ToOk ();
212+ }
213+ ```
214+
188215This allows you to set properties on the RouteGroupBuilder. This will effect all minimal apis in the * Build* method.
189216
190217You can also configure it differently per ApiVersion.
0 commit comments