Minor fixes

This commit is contained in:
2024-02-26 00:23:58 +01:00
parent 3a17924f65
commit 44bd8b9091
5 changed files with 44 additions and 7 deletions

View File

@@ -5,5 +5,7 @@ public class AppSettings
#nullable enable #nullable enable
public Settings? Settings { get; set; } public Settings? Settings { get; set; }
public PrivateSettings? PrivateSettings { get; set; } public PrivateSettings? PrivateSettings { get; set; }
public OpenApiSettings? OpenApiSettings { get; set; }
#nullable disable #nullable disable
} }

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -1,8 +1,9 @@
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using BasicDotnetTemplate.Controllers;
using BasicDotnetTemplate.Models.Settings; using BasicDotnetTemplate.Models.Settings;
namespace BasicDotnetTemplate; namespace BasicDotnetTemplate;
internal class Program internal static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
@@ -63,10 +64,15 @@ internal class Program
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.MapGet("/", () => app.UseHttpsRedirection();
{ app.UseStaticFiles();
return "Hello World!";
}); app.UseRouting();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}"
);
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
@@ -76,7 +82,6 @@ internal class Program
{ {
options.InjectStylesheet("/swagger-ui/custom.css"); options.InjectStylesheet("/swagger-ui/custom.css");
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"); options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
// options.RoutePrefix = string.Empty;
}); });
} }

View File

@@ -4,7 +4,18 @@
"Settings": { "Settings": {
"Name": "BasicDotnetTemplate", "Name": "BasicDotnetTemplate",
"Version": "v1.0", "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": ""
}
} }
} }