1717using Microsoft . Extensions . DependencyInjection ;
1818using Microsoft . Extensions . Diagnostics . HealthChecks ;
1919using Microsoft . Extensions . Hosting ;
20+ using Serilog ;
2021
2122namespace Dotnet6 . GraphQL4 . Store . WebAPI
2223{
@@ -37,46 +38,45 @@ public void Configure(IApplicationBuilder app)
3738 {
3839 if ( _env . IsDevelopment ( ) )
3940 app . UseDeveloperExceptionPage ( ) ;
40-
41- app . UseApplicationGraphQL < StoreSchema > ( ) ;
4241
43- app . UseRouting ( )
44- . UseEndpoints ( endpoints =>
45- {
46- endpoints . MapControllers ( ) ;
42+ app . UseSerilogRequestLogging ( )
43+ . UseApplicationGraphQL < StoreSchema > ( )
44+ . UseRouting ( )
45+ . UseEndpoints (
46+ endpoints =>
47+ {
48+ endpoints . MapControllers ( ) ;
4749
48- endpoints . MapDumpConfig (
49- pattern : "/dump-config" ,
50- configInfo : ( _configuration as IConfigurationRoot ) . GetDebugView ( ) ,
51- isDevelopment : _env . IsDevelopment ( ) ) ;
52-
53- endpoints . MapApplicationHealthChecks (
54- pattern : _configuration [ "HealthChecksPatterns:Health" ] ,
55- predicate : registration
56- => registration . Tags . Any ( ) is false ) ;
57-
58- endpoints . MapApplicationHealthChecks (
59- pattern : _configuration [ "HealthChecksPatterns:Liveness" ] ,
60- predicate : registration
61- => registration . Tags . Any ( item
62- => _livenessTags . Contains ( item ) ) ) ;
63-
64- endpoints . MapApplicationHealthChecks (
65- pattern : _configuration [ "HealthChecksPatterns:Readiness" ] ,
66- predicate : registration
67- => registration . Tags . Any ( item
68- => _readinessTags . Contains ( item ) ) ) ;
50+ endpoints . MapDumpConfig (
51+ pattern : "/dump-config" ,
52+ configInfo : ( _configuration as IConfigurationRoot ) . GetDebugView ( ) ,
53+ isDevelopment : _env . IsDevelopment ( ) ) ;
6954
70- endpoints . MapHealthChecks (
71- pattern : _configuration [ "HealthChecksPatterns:UI" ] ,
72- options : new ( ) { ResponseWriter = UIResponseWriter . WriteHealthCheckUIResponse } ) ;
73- } ) ;
55+ endpoints . MapApplicationHealthChecks (
56+ pattern : _configuration [ "HealthChecksPatterns:Health" ] ,
57+ predicate : registration
58+ => registration . Tags . Any ( ) is false ) ;
59+
60+ endpoints . MapApplicationHealthChecks (
61+ pattern : _configuration [ "HealthChecksPatterns:Liveness" ] ,
62+ predicate : registration
63+ => registration . Tags . Any ( item
64+ => _livenessTags . Contains ( item ) ) ) ;
65+
66+ endpoints . MapApplicationHealthChecks (
67+ pattern : _configuration [ "HealthChecksPatterns:Readiness" ] ,
68+ predicate : registration
69+ => registration . Tags . Any ( item
70+ => _readinessTags . Contains ( item ) ) ) ;
71+
72+ endpoints . MapHealthChecks (
73+ pattern : _configuration [ "HealthChecksPatterns:UI" ] ,
74+ options : new ( ) { ResponseWriter = UIResponseWriter . WriteHealthCheckUIResponse } ) ;
75+ } ) ;
7476 }
7577
7678 public void ConfigureServices ( IServiceCollection services )
7779 {
78- services . AddControllers ( ) ;
79-
8080 services
8181 . AddBuilders ( )
8282 . AddRepositories ( )
@@ -85,7 +85,8 @@ public void ConfigureServices(IServiceCollection services)
8585 . AddApplicationServices ( )
8686 . AddApplicationMessageServices ( )
8787 . AddApplicationSubjects ( )
88- . AddApplicationAutoMapper ( ) ;
88+ . AddApplicationAutoMapper ( )
89+ . AddControllers ( ) ;
8990
9091 services . AddApplicationDbContext ( options =>
9192 {
0 commit comments