Skip to content

Commit 6d76d05

Browse files
author
Sergey Tregub
committed
Use constant for the health check endpoint
1 parent 3ddb2dd commit 6d76d05

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

ProjectTemplates/ReferenceProject/Constants.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@ public static class Swagger
88
public static string ApiName => "My API";
99
public static string Version => "v1";
1010
}
11+
12+
public static class Health
13+
{
14+
public static string EndPoint => "/health";
15+
}
1116
}
1217
}

ProjectTemplates/ReferenceProject/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void Configure(IApplicationBuilder app)
165165
app.UseEndpoints(endpoints =>
166166
{
167167
endpoints.MapDefaultControllerRoute();
168-
endpoints.MapHealthChecks("/health"); // TODO: Must be documented: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-3.1
168+
endpoints.MapHealthChecks(Constants.Health.EndPoint); // TODO: Must be documented: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-3.1
169169
});
170170

171171
Logger.LogInformation("Server started");

0 commit comments

Comments
 (0)