Files
Servers/MoonlightServers.Daemon/Http/Controllers/HealthController.cs

30 lines
735 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MoonlightServers.Daemon.Services;
using MoonlightServers.DaemonShared.Http.Daemon;
namespace MoonlightServers.Daemon.Http.Controllers;
[Authorize]
[ApiController]
[Route("api/health")]
public class HealthController : Controller
{
private readonly RemoteService RemoteService;
public HealthController(RemoteService remoteService)
{
RemoteService = remoteService;
}
[HttpGet]
public async Task<ActionResult<HealthDto>> GetAsync()
{
var remoteStatusCode = await RemoteService.CheckReachabilityAsync();
return new HealthDto()
{
RemoteStatusCode = remoteStatusCode
};
}
}