mirror of
https://github.com/unclshura/BlazorOpenApi.git
synced 2025-12-21 18:01:53 +00:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Hosting.StaticWebAssets;
|
|
using MudBlazor.Services;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorPages();
|
|
builder.Services.AddServerSideBlazor();
|
|
builder.Services.AddMudServices();
|
|
|
|
builder.Services.AddControllers();
|
|
//builder.Services.AddSwaggerGen(c =>
|
|
//{
|
|
// c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
|
|
//});
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
//app.UseSwagger();
|
|
|
|
//app.UseReDoc(c =>
|
|
//{
|
|
// c.DocumentTitle = "REDOC API Documentation";
|
|
// c.SpecUrl = "/swagger/v1/swagger.json";
|
|
//});
|
|
|
|
app.MapBlazorHub();
|
|
app.MapFallbackToPage("/_Host");
|
|
|
|
app.Run(); |