This commit is contained in:
2025-05-04 22:11:28 +08:00
parent 09afa239a6
commit b7eb0f9a68
69 changed files with 344 additions and 178 deletions

View File

@@ -1,4 +1,6 @@
namespace Yes.Blog
using Microsoft.AspNetCore.Http;
namespace Yes.Blog
{
public static class DependencyInjection
{
@@ -26,6 +28,27 @@
services.AddUserAuthentication();
services.AddAuthorization();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddOpenApi(options =>
{
options.AddDocumentTransformer((document, context, cancellationToken) =>
{
document.Info = new()
{
Title = "API",
Version = "V1",
Description = ""
};
return Task.CompletedTask;
});
});
return services;
}
@@ -202,10 +225,13 @@
var endpoints = app.Services.GetRequiredService<IEnumerable<IEndpoint>>().OrderByDescending(x => x.Priority);
foreach (var route in endpoints)
{
var routeGroup = app.MapGroup($"/{route.SchemeName}");
var routeGroup = app.MapGroup($"/{route.Prefix}").WithTags(route.Tags);
route.Map(routeGroup);
}
return app;
}