Implemented node crud and status health check. Added daemon status health endpoint. Refactored project structure. Added sidebar items and ui views
This commit is contained in:
30
MoonlightServers.Daemon/Http/Controllers/HealthController.cs
Normal file
30
MoonlightServers.Daemon/Http/Controllers/HealthController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user