33using PocketDDD . Server . Services ;
44using PocketDDD . Server . WebAPI . Authentication ;
55
6- string corsPolicy = "corsPolicy" ;
6+ var corsPolicy = "corsPolicy" ;
77
88var builder = WebApplication . CreateBuilder ( args ) ;
99
1010// Add services to the container.
11-
1211builder . Services . AddControllers ( ) ;
12+
1313// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
1414builder . Services . AddEndpointsApiExplorer ( ) ;
1515builder . Services . AddSwaggerGen ( ) ;
1616builder . Services . AddCors ( options =>
1717{
1818 options . AddPolicy ( corsPolicy ,
19- builder =>
20- {
21- builder . AllowAnyHeader ( )
22- . AllowAnyMethod ( )
23- . AllowAnyOrigin ( ) ;
24- } ) ;
19+ builder =>
20+ {
21+ builder . AllowAnyHeader ( )
22+ . AllowAnyMethod ( )
23+ . AllowAnyOrigin ( ) ;
24+ } ) ;
2525} ) ;
2626
2727builder . Services . AddDbContext < PocketDDDContext > (
28- options => options . UseSqlServer ( "name=ConnectionStrings:PocketDDDContext" ) ) ;
28+ options => options . UseSqlServer ( "name=ConnectionStrings:PocketDDDContext" )
29+ ) ;
2930
3031builder . Services . AddScoped < RegistrationService > ( ) ;
3132builder . Services . AddScoped < UserService > ( ) ;
3738builder . Services . AddHttpClient < SessionizeService > ( ) ;
3839
3940builder . Services . AddAuthentication ( )
40- . AddScheme < UserIsRegisteredOptions , UserIsRegisteredAuthHandler > ( UserIsRegisteredAuthHandler . SchemeName , null ) ;
41+ . AddScheme < UserIsRegisteredOptions , UserIsRegisteredAuthHandler > ( UserIsRegisteredAuthHandler . SchemeName , null ) ;
42+
43+ builder . Services . AddHealthChecks ( )
44+ . AddDbContextCheck < PocketDDDContext > ( ) ;
4145
4246var app = builder . Build ( ) ;
4347
5559app . UseAuthorization ( ) ;
5660
5761app . MapControllers ( ) ;
62+ app . MapHealthChecks ( "/healthz" ) ;
5863
59- app . Run ( ) ;
64+ app . Run ( ) ;
0 commit comments