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,8 +1,8 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ServerManager.WebApplication.Controllers
|
||||
{
|
||||
namespace ServerManager.WebApplication.Controllers;
|
||||
|
||||
[Route("api/plugin")]
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
|
|
@ -31,4 +31,3 @@ namespace ServerManager.WebApplication.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ 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")]
|
||||
|
|
@ -76,4 +76,3 @@ namespace ServerManager.WebApplication.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue