聚合 OpenApi 文档

This commit is contained in:
administrator committed 2024-04-20 22:15:14 +08:00
1 parent 6f4a338bb4
commit f13e775ca1
9 files changed
+1873 -10

No files matched your search

+7 -10
View File
@@ -1,3 +1,5 @@
using HelloShop.ServiceDefaults.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
@@ -5,25 +7,20 @@ builder.AddServiceDefaults();
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddOpenApi();
var app = builder.Build();
app.MapDefaultEndpoints();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseCors(options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
app.MapControllers();
app.UseOpenApi();
app.Run();