swagger配置

master
lxw 5 months ago
parent 24d08a2e3d
commit 182f49d6b4

@ -43,6 +43,16 @@ builder.Services.AddCors(options =>
);
});
builder.Services.AddSwaggerGen(c =>
{
string? basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); //获取应用程序所在目录
if (basePath != null)
{
string xmlPath = Path.Combine(basePath, "WebStarter.xml");
c.IncludeXmlComments(xmlPath);
}
});
builder.Services.AddControllers().AddJsonOptions(configure =>
{
configure.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter());

Loading…
Cancel
Save