From d886fa24a66e75de44b481990b5dc3ceead076e4 Mon Sep 17 00:00:00 2001 From: jhim Date: Fri, 6 Feb 2026 08:29:28 +0100 Subject: [PATCH] Add project files. --- 4Gewinnt.sln | 25 +++++++++++++++ API/API.csproj | 13 ++++++++ API/API.http | 6 ++++ API/Controllers/WeatherForecastController.cs | 33 ++++++++++++++++++++ API/Program.cs | 23 ++++++++++++++ API/Properties/launchSettings.json | 23 ++++++++++++++ API/appsettings.Development.json | 8 +++++ API/appsettings.json | 9 ++++++ 8 files changed, 140 insertions(+) create mode 100644 4Gewinnt.sln create mode 100644 API/API.csproj create mode 100644 API/API.http create mode 100644 API/Controllers/WeatherForecastController.cs create mode 100644 API/Program.cs create mode 100644 API/Properties/launchSettings.json create mode 100644 API/appsettings.Development.json create mode 100644 API/appsettings.json diff --git a/4Gewinnt.sln b/4Gewinnt.sln new file mode 100644 index 0000000..8cf757e --- /dev/null +++ b/4Gewinnt.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36915.13 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "API", "API\API.csproj", "{1A12D191-511F-457C-9E86-AD4EF905518D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1A12D191-511F-457C-9E86-AD4EF905518D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1A12D191-511F-457C-9E86-AD4EF905518D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A12D191-511F-457C-9E86-AD4EF905518D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1A12D191-511F-457C-9E86-AD4EF905518D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2FA751CE-77EB-47A3-9CBC-00E74A7CD09D} + EndGlobalSection +EndGlobal diff --git a/API/API.csproj b/API/API.csproj new file mode 100644 index 0000000..e292517 --- /dev/null +++ b/API/API.csproj @@ -0,0 +1,13 @@ + + + + net9.0 + enable + enable + + + + + + + diff --git a/API/API.http b/API/API.http new file mode 100644 index 0000000..a06f7ca --- /dev/null +++ b/API/API.http @@ -0,0 +1,6 @@ +@API_HostAddress = http://localhost:5050 + +GET {{API_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/API/Controllers/WeatherForecastController.cs b/API/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..aaf3a93 --- /dev/null +++ b/API/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +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/Program.cs b/API/Program.cs new file mode 100644 index 0000000..666a9c5 --- /dev/null +++ b/API/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/API/Properties/launchSettings.json b/API/Properties/launchSettings.json new file mode 100644 index 0000000..0be700e --- /dev/null +++ b/API/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:5050", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7149;http://localhost:5050", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/API/appsettings.Development.json b/API/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/API/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/API/appsettings.json b/API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}