Healthz.Api is a C# minimal API showcasing usage of health checks. The API makes usage of:
- Registering a library health check
- Registering a custom health check
- Filter health checks
- Customising output
git clone https://github.com/reggieray/dotnet-health-checks
Run from either two options below:
dotnet run --project ./src/Healthz.Api/ --configuration Release
docker-compose up --build
Explore HealthzApi.http and make requests with the following options available:
- Visual Studio: Visual Studio .http files
- VSCode: VS Code REST Client extension
- CLI: httpYac
Example usage using httpYac:
httpyac HealthzApi.http
dotnet test ./tests/Healthz.Api.Tests/ --configuration Release
Alter configuration or environment variables to change the output of the health checks.
Alter the HealthCheck
section within appsettings.Development.json and re-run.
{
/*config removed for brevity*/
"HealthCheck": {
"MyCustomStartUpHealthCheck": "False",
"UriCheck": "https://matthewregis.dev/"
}
}
Alter the environment
section within docker-compose.yaml and re-run.
version: "3"
services:
healthzapi:
environment:
HealthCheck__MyCustomStartUpHealthCheck: "False"
HealthCheck__UriCheck: "https://matthewregis.dev"
# config removed for brevity #