btcpayserver/BTCPayServer/Controllers/GreenField/HealthController.cs

31 lines
812 B
C#
Raw Normal View History

using BTCPayServer.Client.Models;
2020-06-28 10:55:27 +02:00
using BTCPayServer.HostedServices;
2020-04-16 15:39:08 +02:00
using Microsoft.AspNetCore.Authorization;
2020-06-30 08:26:19 +02:00
using Microsoft.AspNetCore.Cors;
2020-04-16 15:39:08 +02:00
using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Controllers.GreenField
{
2020-04-21 17:09:17 +02:00
[Controller]
2020-06-30 08:26:19 +02:00
[EnableCors(CorsPolicies.All)]
2020-04-16 15:39:08 +02:00
public class HealthController : ControllerBase
{
private readonly NBXplorerDashboard _dashBoard;
public HealthController(NBXplorerDashboard dashBoard )
{
_dashBoard = dashBoard;
}
2020-04-16 15:39:08 +02:00
[AllowAnonymous]
[HttpGet("~/api/v1/health")]
public ActionResult GetHealth()
2020-04-16 15:39:08 +02:00
{
ApiHealthData model = new ApiHealthData()
{
Synchronized = _dashBoard.IsFullySynched()
};
return Ok(model);
2020-04-16 15:39:08 +02:00
}
}
}