From b37d6a70e8a84479eace54969f2cee4278e6e91b Mon Sep 17 00:00:00 2001 From: Reimar Date: Mon, 12 Aug 2024 10:18:19 +0200 Subject: [PATCH] Create healthcheck --- API/API.csproj | 1 + API/Controllers/HealthCheckController.cs | 14 +++++++++ API/Controllers/WeatherForecastController.cs | 33 -------------------- API/WeatherForecast.cs | 13 -------- 4 files changed, 15 insertions(+), 46 deletions(-) create mode 100644 API/Controllers/HealthCheckController.cs delete mode 100644 API/Controllers/WeatherForecastController.cs delete mode 100644 API/WeatherForecast.cs diff --git a/API/API.csproj b/API/API.csproj index 9397a87..7e107e7 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -11,6 +11,7 @@ + diff --git a/API/Controllers/HealthCheckController.cs b/API/Controllers/HealthCheckController.cs new file mode 100644 index 0000000..4d08a42 --- /dev/null +++ b/API/Controllers/HealthCheckController.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; + +namespace API.Controllers +{ + [ApiController] + [Route("[controller]")] + public class HealthCheckController : ControllerBase + { + [HttpGet(Name = "HealthCheck")] + public void Get() + { + } + } +} diff --git a/API/Controllers/WeatherForecastController.cs b/API/Controllers/WeatherForecastController.cs deleted file mode 100644 index aaf3a93..0000000 --- a/API/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace API.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} diff --git a/API/WeatherForecast.cs b/API/WeatherForecast.cs deleted file mode 100644 index 10c41a8..0000000 --- a/API/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace API -{ - public class WeatherForecast - { - public DateOnly Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -}