Skip to content

Health Check

Health check API

Monitoring tools call a simple API which return http 200 ok and simple word like Healthy to know whether the service is available or not.

In Program.cs, add

csharp
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddHealthChecks(); //add this

//...

var app = builder.Build();

app.MapHealthChecks("/health"); //add this

//...

.http

Back in Rider, notice there's a Library.http file with a Run button. These provide a way to call APIs in Rider without switching to another tool like Postman, Insomnia, Bruno or EchoAPI.

Let's update Library.http to call /health

alt text



To do the same in Visual Studio Code, install an extension called REST Client.

alt text

Released under the MIT License.