core: Implement /health endpoint (healthcheck). Resolves #12784 (#12798)

This commit is contained in:
Diego Heras
2022-01-09 23:15:50 +01:00
committed by GitHub
parent c01b8a3a33
commit bd13e1256f

View File

@@ -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<IActionResult> Health()
{
var jsonReply = new JObject
{
["status"] = "OK"
};
return Task.FromResult<IActionResult>(Json(jsonReply));
}
}
}