aboutsummaryrefslogtreecommitdiff
path: root/API
diff options
context:
space:
mode:
Diffstat (limited to 'API')
-rw-r--r--API/Controllers/ErrorController.cs13
-rw-r--r--API/Controllers/WeatherForecastController.cs37
-rw-r--r--API/Program.cs16
-rw-r--r--API/Startup.cs4
-rw-r--r--API/WeatherForecast.cs15
5 files changed, 25 insertions, 60 deletions
diff --git a/API/Controllers/ErrorController.cs b/API/Controllers/ErrorController.cs
new file mode 100644
index 0000000..4c5d9ef
--- /dev/null
+++ b/API/Controllers/ErrorController.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace API.Controllers
+{
+ public class ErrorController
+ {
+ //FIXME: SHOULD NOT BE VOID
+ public void Error(Exception exception)
+ {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/API/Controllers/WeatherForecastController.cs b/API/Controllers/WeatherForecastController.cs
deleted file mode 100644
index a90538d..0000000
--- a/API/Controllers/WeatherForecastController.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-
-namespace API.Controllers
-{
- [ApiController]
- [Route("[controller]")]
- public class WeatherForecastController : ControllerBase
- {
- private readonly ILogger<WeatherForecastController> _logger;
- private static readonly string[] Summaries = new[]
- {
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
-
- public WeatherForecastController(ILogger<WeatherForecastController> logger)
- {
- _logger = logger;
- }
-
- [HttpGet]
- public IEnumerable<WeatherForecast> Get()
- {
- var rng = new Random();
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
- {
- Date = DateTime.Now.AddDays(index),
- TemperatureC = rng.Next(-20, 55),
- Summary = Summaries[rng.Next(Summaries.Length)]
- })
- .ToArray();
- }
- }
-}
diff --git a/API/Program.cs b/API/Program.cs
index 8125904..eedd5e1 100644
--- a/API/Program.cs
+++ b/API/Program.cs
@@ -4,13 +4,13 @@ using Microsoft.Extensions.Hosting;
namespace API
{
public class Program
- {
- private const int HTTPS_PORT = 5020;
+ {
+ private const int HTTPS_PORT = 5000;
public static void Main(string[] args)
- {
- CreateHostBuilder(args).Build().Run();
- }
+ {
+ CreateHostBuilder(args).Build().Run();
+ }
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
@@ -18,7 +18,7 @@ namespace API
{
webBuilder.ConfigureKestrel(opt => opt.ListenLocalhost(HTTPS_PORT));
- webBuilder.UseStartup<Startup>();
- });
- }
+ webBuilder.UseStartup<Startup>();
+ });
+ }
}
diff --git a/API/Startup.cs b/API/Startup.cs
index 61bcaff..6167993 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -56,6 +56,10 @@ namespace API
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));
}
+ else
+ {
+ app.UseExceptionHandler();
+ }
app.UseHttpsRedirection();
app.UseRouting();
diff --git a/API/WeatherForecast.cs b/API/WeatherForecast.cs
deleted file mode 100644
index 746c136..0000000
--- a/API/WeatherForecast.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace API
-{
- public class WeatherForecast
- {
- public DateTime Date { get; set; }
-
- public int TemperatureC { get; set; }
-
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-
- public string Summary { get; set; }
- }
-}