From 8e1212d986830a0a8effa825825afd4f91c4e2d7 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 8 Mar 2025 10:15:39 +0100 Subject: [PATCH] feat: add initial configuration files and setup for .NET 9 API --- .../Properties/launchSettings.json | 16 ------------- .../Suspectus.Mithrandir.Api/Program.cs | 23 +++++++++++++++++++ .../Properties/launchSettings.json | 23 +++++++++++++++++++ .../Suspectus.Mithrandir.Api.csproj | 13 +++++++++++ .../appsettings.Development.json | 8 +++++++ .../Suspectus.Mithrandir.Api/appsettings.json | 9 ++++++++ src/dotnet/Suspectus.sln | 7 ++++++ 7 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 src/dotnet/Suspectus.Mithrandir.Api/Program.cs create mode 100644 src/dotnet/Suspectus.Mithrandir.Api/Properties/launchSettings.json create mode 100644 src/dotnet/Suspectus.Mithrandir.Api/Suspectus.Mithrandir.Api.csproj create mode 100644 src/dotnet/Suspectus.Mithrandir.Api/appsettings.Development.json create mode 100644 src/dotnet/Suspectus.Mithrandir.Api/appsettings.json diff --git a/src/dotnet/Suspectus.Gandalf.Api/Properties/launchSettings.json b/src/dotnet/Suspectus.Gandalf.Api/Properties/launchSettings.json index 0608cc5..d2ca3c6 100644 --- a/src/dotnet/Suspectus.Gandalf.Api/Properties/launchSettings.json +++ b/src/dotnet/Suspectus.Gandalf.Api/Properties/launchSettings.json @@ -1,13 +1,5 @@ { "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:48302", - "sslPort": 44338 - } - }, "profiles": { "http": { "commandName": "Project", @@ -28,14 +20,6 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": false, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } } } } diff --git a/src/dotnet/Suspectus.Mithrandir.Api/Program.cs b/src/dotnet/Suspectus.Mithrandir.Api/Program.cs new file mode 100644 index 0000000..7688653 --- /dev/null +++ b/src/dotnet/Suspectus.Mithrandir.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(); \ No newline at end of file diff --git a/src/dotnet/Suspectus.Mithrandir.Api/Properties/launchSettings.json b/src/dotnet/Suspectus.Mithrandir.Api/Properties/launchSettings.json new file mode 100644 index 0000000..3d5378d --- /dev/null +++ b/src/dotnet/Suspectus.Mithrandir.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:5055", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7288;http://localhost:5055", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/dotnet/Suspectus.Mithrandir.Api/Suspectus.Mithrandir.Api.csproj b/src/dotnet/Suspectus.Mithrandir.Api/Suspectus.Mithrandir.Api.csproj new file mode 100644 index 0000000..d5e886e --- /dev/null +++ b/src/dotnet/Suspectus.Mithrandir.Api/Suspectus.Mithrandir.Api.csproj @@ -0,0 +1,13 @@ + + + + net9.0 + enable + enable + + + + + + + diff --git a/src/dotnet/Suspectus.Mithrandir.Api/appsettings.Development.json b/src/dotnet/Suspectus.Mithrandir.Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/dotnet/Suspectus.Mithrandir.Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/dotnet/Suspectus.Mithrandir.Api/appsettings.json b/src/dotnet/Suspectus.Mithrandir.Api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/dotnet/Suspectus.Mithrandir.Api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/dotnet/Suspectus.sln b/src/dotnet/Suspectus.sln index e2f4726..96c020c 100644 --- a/src/dotnet/Suspectus.sln +++ b/src/dotnet/Suspectus.sln @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mithrandir", "Mithrandir", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gandalf", "Gandalf", "{A82EA24B-1379-41B2-A363-CDCBF9F18833}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Suspectus.Mithrandir.Api", "Suspectus.Mithrandir.Api\Suspectus.Mithrandir.Api.csproj", "{264B8A9E-7A70-4DE3-906B-7E0722D09205}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,11 +36,16 @@ Global {44C283FD-2E01-496C-9E8F-4E43C26C9733}.Debug|Any CPU.Build.0 = Debug|Any CPU {44C283FD-2E01-496C-9E8F-4E43C26C9733}.Release|Any CPU.ActiveCfg = Release|Any CPU {44C283FD-2E01-496C-9E8F-4E43C26C9733}.Release|Any CPU.Build.0 = Release|Any CPU + {264B8A9E-7A70-4DE3-906B-7E0722D09205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {264B8A9E-7A70-4DE3-906B-7E0722D09205}.Debug|Any CPU.Build.0 = Debug|Any CPU + {264B8A9E-7A70-4DE3-906B-7E0722D09205}.Release|Any CPU.ActiveCfg = Release|Any CPU + {264B8A9E-7A70-4DE3-906B-7E0722D09205}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {44C283FD-2E01-496C-9E8F-4E43C26C9733} = {A82EA24B-1379-41B2-A363-CDCBF9F18833} {067494CB-FE63-42F0-A154-586E50442969} = {A82EA24B-1379-41B2-A363-CDCBF9F18833} {B4AF6985-3268-4C2E-9C50-D92DA7D3711D} = {A82EA24B-1379-41B2-A363-CDCBF9F18833} {C8C3047B-ED0B-4516-A282-8B07E3EEB430} = {A82EA24B-1379-41B2-A363-CDCBF9F18833} + {264B8A9E-7A70-4DE3-906B-7E0722D09205} = {D54D8A40-A5C3-4273-B4D7-F2B83056161B} EndGlobalSection EndGlobal