From bd13e1256f2d16dece92c6f9e30f274863d0617c Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Sun, 9 Jan 2022 23:15:50 +0100 Subject: [PATCH] core: Implement /health endpoint (healthcheck). Resolves #12784 (#12798) --- .../Controllers/HealthcheckController.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Jackett.Server/Controllers/HealthcheckController.cs diff --git a/src/Jackett.Server/Controllers/HealthcheckController.cs b/src/Jackett.Server/Controllers/HealthcheckController.cs new file mode 100644 index 000000000..11fdd4862 --- /dev/null +++ b/src/Jackett.Server/Controllers/HealthcheckController.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json.Linq; + +namespace Jackett.Server.Controllers +{ + [AllowAnonymous] + [Route("health")] + public class HealthcheckController : Controller + { + [HttpGet] + [HttpHead] + public Task Health() + { + var jsonReply = new JObject + { + ["status"] = "OK" + }; + return Task.FromResult(Json(jsonReply)); + } + } +}