From 1f1f701776d8d10d09bb06c586980dcc5b67be2c Mon Sep 17 00:00:00 2001 From: Robin-Manuel Thiel Date: Sat, 27 Apr 2024 10:26:59 +0200 Subject: [PATCH] Update README.md --- README.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 15b770b..c88b59e 100644 --- a/README.md +++ b/README.md @@ -25,18 +25,22 @@ public Startup(IConfiguration configuration) _options .AddMiddleware(); - // Add Swagger + // Swagger _options .AddOpenApi("v1") .WithApiGroup("public", "Fancy API", "This is my fancy API.") .WithSecurityScheme(SecuritySchemeDefaults.JwtBearer); - // Add Monitoring + // Monitoring _options .AddMonitoring() .WithMeter(Observability.Meter.Name) .WithApplicationInsights(Configuration["AzureApplicationInsightsConnectionString"]) .WithPrometheus(); + + // Health Checks + _options.ConfigureHealthChecks(builder => + builder.AddCheck("MyHealthCheck", () => HealthCheckResult.Healthy("Everything is fine.")); } ``` @@ -90,14 +94,27 @@ For modern or Minimal API services (introduced in .NET 6), this would look simil ```csharp var options = new StartupOptions(); + +// Middleware +options + .AddMiddleware(); + +// Swagger options .AddOpenApi("v1") + .WithApiGroup("public", "Fancy API", "This is my fancy API.") + .WithSecurityScheme(SecuritySchemeDefaults.JwtBearer); +// Monitoring options .AddMonitoring() + .WithMeter(Observability.Meter.Name) .WithApplicationInsights(Configuration["AzureApplicationInsightsConnectionString"]) + .WithPrometheus(); -// ... +// Health Checks +options.ConfigureHealthChecks(builder => + builder.AddCheck("MyHealthCheck", () => HealthCheckResult.Healthy("Everything is fine.")); app.AddDefaultSetup(options); app.UseDefaultSetup(app.Environment, options);