Skip to content

Commit 1aca11e

Browse files
Merge pull request #8 from WrapThat/api-grouping
Added endpoint grouping for minimal apis
2 parents 50e0671 + f130a0d commit 1aca11e

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

WrapThat.Version/WebApplicationExtensions.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@ public static class WebApplicationExtensions
99
{
1010
public static WebApplication MapVersionApiEndpoints(this WebApplication app)
1111
{
12-
var controller = new InfoController();
13-
14-
app.MapGet("/api/info", [AllowAnonymous] () => HandleRequest(c=>c.Info()));
15-
16-
app.MapGet("/api/info/version", [AllowAnonymous] () => HandleRequest(c => c.Version()));
17-
18-
app.MapGet("/api/info/productversion", [AllowAnonymous] () => HandleRequest(c => c.ProductVersion()));
19-
20-
app.MapGet("/api/info/shields/version", [AllowAnonymous] () => HandleRequest(c => c.InfoShields()));
21-
22-
app.MapGet("/api/info/shields/productversion", [AllowAnonymous] () => HandleRequest(c => c.ProductVersionShields()));
23-
24-
app.MapGet("/api/info/status", [AllowAnonymous] () => HandleRequest(c => c.Status()));
25-
12+
var infoGroup = app.MapGroup("/api/info").WithTags("Version");
13+
infoGroup.MapGet("/", [AllowAnonymous] () => HandleRequest(c=>c.Info()));
14+
infoGroup.MapGet("/version", [AllowAnonymous] () => HandleRequest(c => c.Version()));
15+
infoGroup.MapGet("/productversion", [AllowAnonymous] () => HandleRequest(c => c.ProductVersion()));
16+
infoGroup.MapGet("/shields/version", [AllowAnonymous] () => HandleRequest(c => c.InfoShields()));
17+
infoGroup.MapGet("/shields/productversion", [AllowAnonymous] () => HandleRequest(c => c.ProductVersionShields()));
18+
infoGroup.MapGet("/status", [AllowAnonymous] () => HandleRequest(c => c.Status()));
2619
return app;
2720
}
2821

0 commit comments

Comments
 (0)