skantravels/services/AuthorizationService/Controllers/HealthCheckController.cs

21 lines
468 B
C#
Raw Permalink Normal View History

2024-08-12 09:18:19 +01:00
using Microsoft.AspNetCore.Mvc;
2024-08-15 14:21:17 +01:00
namespace AuthorizationService.Controllers
2024-08-12 09:18:19 +01:00
{
[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
}
}
}