From the course: ASP.NET Core: Health Checks and Logging

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Solution: Add a health check to the sample app

Solution: Add a health check to the sample app - ASP.NET Core Tutorial

From the course: ASP.NET Core: Health Checks and Logging

Start my 1-month free trial

Solution: Add a health check to the sample app

(upbeat music) - [Instructor] So far, we have only worked with one API endpoint in our API. In our product controller, the big get method, which as the name suggests retrieves all of the products from the database. That's not the best way to test whether the API is alive or not. Because it hits the database. And we have an extra health check for the database anyway. And well, it takes some time and resources. However, the endpoint for a health check for an API, it needs to be efficient. It shouldn't hit the system hard. And therefore, I'm just adding a new controller for exactly that purpose. So new controller. I'm using an API controller. And actually, I used the template which scaffolds me a little bit of the infrastructure. And I just call this the alive controller. And in the alive controller, which I would like to access via slash alive. I just have a get method. But it doesn't return list of strings. It…

Contents