skantravels/API/Controllers/HealthCheckController.cs

21 lines
451 B
C#
Raw Normal View History

2024-08-12 09:18:19 +01:00
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[ApiController]
[Route("[controller]")]
2024-08-12 09:58:27 +01:00
public class HealthCheckController(AppDBContext context) : ControllerBase
2024-08-12 09:18:19 +01:00
{
[HttpGet(Name = "HealthCheck")]
2024-08-12 09:58:27 +01:00
public StatusCodeResult Get()
2024-08-12 09:18:19 +01:00
{
2024-08-12 09:58:27 +01:00
if (!context.Database.CanConnect())
{
return new StatusCodeResult(500);
}
return Ok();
2024-08-12 09:18:19 +01:00
}
}
}