/
aprogrammer
/
reverse-proxy-ms-yarp
Обзор
Документация
Войти
/
aprogrammer
/
reverse-proxy-ms-yarp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
testassets/ReverseProxy.Code/Controllers/HealthController.cs
35 строк
965 B
Kahbazi
Convert to file-scoped namespace (#1382)
15 ноя 2021, 21:15
Не верифицирован
15 ноя 2021, 21:15
efd2a4c
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.AspNetCore.Mvc; using Yarp.ReverseProxy.Health; namespace Yarp.ReverseProxy.Sample.Controllers; /// <summary> /// Controller for health check api. /// </summary> [ApiController] public class HealthController : ControllerBase { private readonly IActiveHealthCheckMonitor _healthCheckMonitor; /// <summary> /// Initializes a new instance of the <see cref="HealthController" /> class. /// </summary> public HealthController(IActiveHealthCheckMonitor healthCheckMonitor) { _healthCheckMonitor = healthCheckMonitor; } /// <summary> /// Returns 200 if Proxy is healthy. /// </summary> [HttpGet] [Route("/api/health")] public IActionResult CheckHealth() { // TODO: Implement health controller, use guid in route. return _healthCheckMonitor.InitialProbeCompleted ? Ok() : StatusCode(503); } }