diff --git a/src/Hng.Web/Controllers/HealthCheckController.cs b/src/Hng.Web/Controllers/HealthCheckController.cs new file mode 100644 index 00000000..d8feed16 --- /dev/null +++ b/src/Hng.Web/Controllers/HealthCheckController.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Hng.Web.Controllers +{ + [Route("")] + [ApiController] + public class HealthCheckController : ControllerBase + { + /// + /// Health Check Endpoint - Verifies that the API is running. + /// + /// Returns API health status. + [HttpGet] + [ProducesResponseType(typeof(HealthCheckResponse), 200)] + [ProducesResponseType(500)] + public ActionResult GetHealthCheck() + { + var response = new HealthCheckResponse + { + StatusCode = 200, + Message = "Welcome to C-Sharp Backend Endpoint" + }; + + return new OkObjectResult(response); + } + } + + /// + /// Represents the response structure for the health check endpoint. + /// + public class HealthCheckResponse + { + /// + /// HTTP status code. + /// + public int StatusCode { get; set; } + + /// + /// Message indicating the API status. + /// + public string Message { get; set; } + } +} +