Added Swashbuckle
This commit is contained in:
parent
2b2eb2cf75
commit
35965be69a
2 changed files with 22 additions and 5 deletions
|
@ -41,6 +41,7 @@
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.11" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.11" />
|
||||||
<PackageReference Include="MudBlazor" Version="6.1.8" />
|
<PackageReference Include="MudBlazor" Version="6.1.8" />
|
||||||
<PackageReference Include="rix0rrr.BeaconLib" Version="1.0.2" />
|
<PackageReference Include="rix0rrr.BeaconLib" Version="1.0.2" />
|
||||||
|
<PackageReference Include="swashbuckle" Version="5.6.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
|
||||||
<PackageReference Include="YamlDotNet" Version="12.3.1" />
|
<PackageReference Include="YamlDotNet" Version="12.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -19,8 +19,12 @@ ConfigurationManager configuration = builder.Configuration;
|
||||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
var settings = SettingService.GetSettings();
|
var settings = SettingService.GetSettings();
|
||||||
|
|
||||||
|
builder.Services.AddMvc(options => options.EnableEndpointRouting = false);
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
builder.Services.AddServerSideBlazor();
|
builder.Services.AddServerSideBlazor().AddCircuitOptions(option =>
|
||||||
|
{
|
||||||
|
option.DetailedErrors = true;
|
||||||
|
});
|
||||||
|
|
||||||
builder.WebHost.ConfigureKestrel(options =>
|
builder.WebHost.ConfigureKestrel(options =>
|
||||||
{
|
{
|
||||||
|
@ -66,11 +70,14 @@ builder.Services.AddAuthentication(options =>
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddControllersWithViews().AddJsonOptions(x =>
|
builder.Services.AddControllers().AddJsonOptions(x =>
|
||||||
{
|
{
|
||||||
x.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
|
x.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
builder.Services.AddMudServices(config =>
|
builder.Services.AddMudServices(config =>
|
||||||
{
|
{
|
||||||
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft;
|
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft;
|
||||||
|
@ -84,6 +91,8 @@ builder.Services.AddMudServices(config =>
|
||||||
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
|
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddHttpClient();
|
||||||
|
|
||||||
builder.Services.AddScoped<SettingService>();
|
builder.Services.AddScoped<SettingService>();
|
||||||
builder.Services.AddScoped<ArchiveService>();
|
builder.Services.AddScoped<ArchiveService>();
|
||||||
builder.Services.AddScoped<CategoryService>();
|
builder.Services.AddScoped<CategoryService>();
|
||||||
|
@ -106,6 +115,8 @@ var app = builder.Build();
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseMigrationsEndPoint();
|
app.UseMigrationsEndPoint();
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -122,9 +133,14 @@ app.UseRouting();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.UseMvcWithDefaultRoute();
|
||||||
app.MapBlazorHub();
|
|
||||||
app.MapFallbackToPage("/_Host");
|
app.UseEndpoints(endpoints =>
|
||||||
|
{
|
||||||
|
endpoints.MapBlazorHub();
|
||||||
|
endpoints.MapFallbackToPage("/_Host");
|
||||||
|
endpoints.MapControllers();
|
||||||
|
});
|
||||||
|
|
||||||
if (!Directory.Exists("Upload"))
|
if (!Directory.Exists("Upload"))
|
||||||
Directory.CreateDirectory("Upload");
|
Directory.CreateDirectory("Upload");
|
||||||
|
|
Loading…
Add table
Reference in a new issue