diff --git a/Liber_Incantamentum.sln b/Liber_Incantamentum.sln new file mode 100644 index 0000000..b3fda7c --- /dev/null +++ b/Liber_Incantamentum.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36109.1 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum", "Liber_Incantamentum\Liber_Incantamentum.csproj", "{BB761821-A9EC-4EBA-83A2-89F32C50041F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B7CB31CD-9866-48CB-8A83-9F2EB1E9E53B} + EndGlobalSection +EndGlobal diff --git a/Liber_Incantamentum/Controllers/WeatherForecastController.cs b/Liber_Incantamentum/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..4369e39 --- /dev/null +++ b/Liber_Incantamentum/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Liber_Incantamentum.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/Liber_Incantamentum/Liber_Incantamentum.csproj b/Liber_Incantamentum/Liber_Incantamentum.csproj new file mode 100644 index 0000000..1fc25bd --- /dev/null +++ b/Liber_Incantamentum/Liber_Incantamentum.csproj @@ -0,0 +1,13 @@ + + + + net9.0 + enable + enable + + + + + + + diff --git a/Liber_Incantamentum/Liber_Incantamentum.http b/Liber_Incantamentum/Liber_Incantamentum.http new file mode 100644 index 0000000..0d48534 --- /dev/null +++ b/Liber_Incantamentum/Liber_Incantamentum.http @@ -0,0 +1,6 @@ +@Liber_Incantamentum_HostAddress = http://localhost:5225 + +GET {{Liber_Incantamentum_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Liber_Incantamentum/Program.cs b/Liber_Incantamentum/Program.cs new file mode 100644 index 0000000..666a9c5 --- /dev/null +++ b/Liber_Incantamentum/Program.cs @@ -0,0 +1,23 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/Liber_Incantamentum/Properties/launchSettings.json b/Liber_Incantamentum/Properties/launchSettings.json new file mode 100644 index 0000000..92c536d --- /dev/null +++ b/Liber_Incantamentum/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5225", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7239;http://localhost:5225", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Liber_Incantamentum/WeatherForecast.cs b/Liber_Incantamentum/WeatherForecast.cs new file mode 100644 index 0000000..5abf9fb --- /dev/null +++ b/Liber_Incantamentum/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace Liber_Incantamentum +{ + 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; } + } +} diff --git a/Liber_Incantamentum/appsettings.Development.json b/Liber_Incantamentum/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Liber_Incantamentum/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Liber_Incantamentum/appsettings.json b/Liber_Incantamentum/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Liber_Incantamentum/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}