diff --git a/Models/Settings/AppSettings.cs b/Models/Settings/AppSettings.cs index c837bbd..901d9c2 100644 --- a/Models/Settings/AppSettings.cs +++ b/Models/Settings/AppSettings.cs @@ -5,5 +5,7 @@ public class AppSettings #nullable enable public Settings? Settings { get; set; } public PrivateSettings? PrivateSettings { get; set; } + public OpenApiSettings? OpenApiSettings { get; set; } + #nullable disable } \ No newline at end of file diff --git a/Models/Settings/OpenApiSettings.cs b/Models/Settings/OpenApiSettings.cs new file mode 100644 index 0000000..055a7b0 --- /dev/null +++ b/Models/Settings/OpenApiSettings.cs @@ -0,0 +1,10 @@ +namespace BasicDotnetTemplate.Models.Settings; + +public class OpenApiSettings +{ +#nullable enable + public string? TermsOfServiceUrl { get; set; } + public OpenApiSettingsDetails? OpenApiContact { get; set; } + public OpenApiSettingsDetails? OpenApiLicense { get; set; } +#nullable disable +} \ No newline at end of file diff --git a/Models/Settings/OpenApiSettingsDetails.cs b/Models/Settings/OpenApiSettingsDetails.cs new file mode 100644 index 0000000..039842b --- /dev/null +++ b/Models/Settings/OpenApiSettingsDetails.cs @@ -0,0 +1,9 @@ +namespace BasicDotnetTemplate.Models.Settings; + +public class OpenApiSettingsDetails +{ +#nullable enable + public string? Name { get; set; } + public string? Url { get; set; } +#nullable disable +} \ No newline at end of file diff --git a/Program.cs b/Program.cs index 06066cd..6009c6e 100644 --- a/Program.cs +++ b/Program.cs @@ -1,8 +1,9 @@ using Microsoft.OpenApi.Models; +using BasicDotnetTemplate.Controllers; using BasicDotnetTemplate.Models.Settings; namespace BasicDotnetTemplate; -internal class Program +internal static class Program { public static void Main(string[] args) { @@ -63,10 +64,15 @@ internal class Program app.UseAuthentication(); app.UseAuthorization(); - app.MapGet("/", () => - { - return "Hello World!"; - }); + app.UseHttpsRedirection(); + app.UseStaticFiles(); + + app.UseRouting(); + + app.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}" + ); if (app.Environment.IsDevelopment()) { @@ -76,7 +82,6 @@ internal class Program { options.InjectStylesheet("/swagger-ui/custom.css"); options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"); - // options.RoutePrefix = string.Empty; }); } diff --git a/appsettings.json b/appsettings.json index 69b888a..7b6d8ae 100644 --- a/appsettings.json +++ b/appsettings.json @@ -4,7 +4,18 @@ "Settings": { "Name": "BasicDotnetTemplate", "Version": "v1.0", - "Description": "This template contains basic configuration for a .Net 8 backend" + "Description": "This template contains basic configuration for a .Net 8 backend" + }, + "OpenApiSettings": { + "TermsOfServiceUrl": "", + "OpenApiContact": { + "Name": "", + "Url": "" + }, + "OpenApiLicense": { + "Name": "", + "Url": "" + } } }