-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register /health endpoint on App and API
- Loading branch information
1 parent
7595704
commit 55c9a2c
Showing
2 changed files
with
264 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,53 @@ | ||
using ConcernsCaseWork.API.Extensions; | ||
using ConcernsCaseWork.API.Middleware; | ||
using ConcernsCaseWork.API.StartupConfiguration; | ||
using ConcernsCaseWork.Middleware; | ||
using Microsoft.AspNetCore.Mvc.ApiExplorer; | ||
|
||
namespace ConcernsCaseWork.API | ||
{ | ||
/// <summary> | ||
/// THIS STARTUP ISN'T USED WHEN API IS HOSTED THROUGH WEBSITE. It is used when running API tests | ||
/// </summary> | ||
public class Startup | ||
{ | ||
public Startup(IConfiguration configuration) | ||
{ | ||
Configuration = configuration; | ||
} | ||
|
||
public IConfiguration Configuration { get; } | ||
|
||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddConcernsApiProject(Configuration); | ||
} | ||
|
||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider) | ||
{ | ||
app.UseConcernsCaseworkSwagger(provider); | ||
|
||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
|
||
app.UseMiddleware<ExceptionHandlerMiddleware>(); | ||
app.UseMiddleware<ApiKeyMiddleware>(); | ||
app.UseMiddleware<UrlDecoderMiddleware>(); | ||
app.UseMiddleware<CorrelationIdMiddleware>(); | ||
app.UseMiddleware<UserContextReceiverMiddleware>(); | ||
|
||
app.UseHttpsRedirection(); | ||
|
||
app.UseRouting(); | ||
|
||
app.UseAuthorization(); | ||
|
||
app.UseConcernsCaseworkEndpoints(); | ||
} | ||
} | ||
} | ||
using ConcernsCaseWork.API.Extensions; | ||
using ConcernsCaseWork.API.Middleware; | ||
using ConcernsCaseWork.API.StartupConfiguration; | ||
using ConcernsCaseWork.Middleware; | ||
using Microsoft.AspNetCore.Mvc.ApiExplorer; | ||
|
||
namespace ConcernsCaseWork.API | ||
{ | ||
/// <summary> | ||
/// THIS STARTUP ISN'T USED WHEN API IS HOSTED THROUGH WEBSITE. It is used when running API tests | ||
/// </summary> | ||
public class Startup | ||
{ | ||
public Startup(IConfiguration configuration) | ||
{ | ||
Configuration = configuration; | ||
} | ||
|
||
public IConfiguration Configuration { get; } | ||
|
||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddConcernsApiProject(Configuration); | ||
} | ||
|
||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider) | ||
{ | ||
app.UseConcernsCaseworkSwagger(provider); | ||
|
||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
|
||
app.UseMiddleware<ExceptionHandlerMiddleware>(); | ||
app.UseMiddleware<ApiKeyMiddleware>(); | ||
app.UseMiddleware<UrlDecoderMiddleware>(); | ||
app.UseMiddleware<CorrelationIdMiddleware>(); | ||
app.UseMiddleware<UserContextReceiverMiddleware>(); | ||
|
||
app.UseHttpsRedirection(); | ||
|
||
app.UseRouting(); | ||
|
||
app.UseAuthorization(); | ||
|
||
app.UseConcernsCaseworkEndpoints(); | ||
|
||
// Add Health Checks | ||
app.UseHealthChecks("/health"); | ||
} | ||
} | ||
} |
Oops, something went wrong.