diff --git a/api/.gitignore b/api/.gitignore new file mode 100644 index 0000000..01e74fd --- /dev/null +++ b/api/.gitignore @@ -0,0 +1,54 @@ + +# generated by dotnet +# curated by yours truly + +# dotenv files +.env + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# NuGet Packages +*.nupkg + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ diff --git a/api/Program.cs b/api/Program.cs new file mode 100644 index 0000000..ee9d65d --- /dev/null +++ b/api/Program.cs @@ -0,0 +1,41 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// 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(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => +{ + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; +}) +.WithName("GetWeatherForecast"); + +app.Run(); + +record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} diff --git a/api/Properties/launchSettings.json b/api/Properties/launchSettings.json new file mode 100644 index 0000000..f689500 --- /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:5227", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7182;http://localhost:5227", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/api/agologum-api.csproj b/api/agologum-api.csproj new file mode 100644 index 0000000..bcac402 --- /dev/null +++ b/api/agologum-api.csproj @@ -0,0 +1,14 @@ + + + + net10.0 + enable + enable + agologum_api + + + + + + + diff --git a/api/agologum-api.http b/api/agologum-api.http new file mode 100644 index 0000000..39b8ff9 --- /dev/null +++ b/api/agologum-api.http @@ -0,0 +1,6 @@ +@agologum_api_HostAddress = http://localhost:5227 + +GET {{agologum_api_HostAddress}}/weatherforecast/ +Accept: application/json + +### 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": "*" +} diff --git a/api/test.cs b/api/test.cs new file mode 100644 index 0000000..ed14715 --- /dev/null +++ b/api/test.cs @@ -0,0 +1,15 @@ + +// this is a test program for making sure your dotnet environment is working properly + +/* +using System.Diagnostics; +using System; + +Stopwatch sw = new Stopwatch(); +sw.Start(); +Console.WriteLine("Hi mom !"); +Console.WriteLine("doing a schmunguss"); +sw.Stop(); + +Console.WriteLine("Time elapsed: {0}", sw.Elapsed); +*/ diff --git a/scripts/execute_all.sh b/scripts/execute_all.sh new file mode 100755 index 0000000..b0ac7d1 --- /dev/null +++ b/scripts/execute_all.sh @@ -0,0 +1,4 @@ + +# idk yet + +dotnet ./api/test.cs