mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
Added new health endpoint
This commit is contained in:
parent
7addb5b6f7
commit
95c8da2053
3 changed files with 108 additions and 83 deletions
|
|
@ -0,0 +1,27 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ServerManager.WebApplication.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Produces("application/json")]
|
||||
public class HealthController : ControllerBase
|
||||
{
|
||||
[HttpGet()]
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public IActionResult Get()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ServerManager.WebApplication.Controllers
|
||||
namespace ServerManager.WebApplication.Controllers;
|
||||
|
||||
[Route("api/plugin")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Produces("application/json")]
|
||||
public class PluginController : ControllerBase
|
||||
{
|
||||
[Route("api/plugin")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Produces("application/json")]
|
||||
public class PluginController : ControllerBase
|
||||
{
|
||||
public PluginController()
|
||||
{
|
||||
}
|
||||
|
|
@ -30,5 +30,4 @@ namespace ServerManager.WebApplication.Controllers
|
|||
return StatusCode(StatusCodes.Status500InternalServerError, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ using ServerManager.WebApplication.Services;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ServerManager.WebApplication.Controllers
|
||||
namespace ServerManager.WebApplication.Controllers;
|
||||
|
||||
[Route("api/server")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Produces("application/json")]
|
||||
public class ServerController : ControllerBase
|
||||
{
|
||||
[Route("api/server")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Produces("application/json")]
|
||||
public class ServerController : ControllerBase
|
||||
{
|
||||
private readonly IServerQueryService _serverQueryService;
|
||||
|
||||
public ServerController(IServerQueryService serverQueryService)
|
||||
|
|
@ -75,5 +75,4 @@ namespace ServerManager.WebApplication.Controllers
|
|||
return StatusCode(StatusCodes.Status500InternalServerError, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue