|
|
|
@ -3,6 +3,7 @@ using Autofac.Extensions.DependencyInjection;
|
|
|
|
|
using DS.Module.AutofacModule;
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.Module.Core.Middlewares;
|
|
|
|
|
using DS.Module.Core.ServiceExtensions;
|
|
|
|
|
using DS.Module.ExcelModule;
|
|
|
|
|
using DS.Module.Jwt;
|
|
|
|
@ -43,43 +44,36 @@ builder.Services.AddMultiLanguageInstall();//
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
|
// if (app.Environment.IsDevelopment())
|
|
|
|
|
// {
|
|
|
|
|
// app.UseSwagger();
|
|
|
|
|
// app.UseSwaggerUI();
|
|
|
|
|
// }
|
|
|
|
|
//swagger
|
|
|
|
|
// app.UseSwagger();
|
|
|
|
|
var documentName = AppSetting.app(new string[] { "SwaggerDoc", "ContactName" });
|
|
|
|
|
app
|
|
|
|
|
.UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; })
|
|
|
|
|
.UseSwaggerUI(c =>
|
|
|
|
|
{
|
|
|
|
|
c.SwaggerEndpoint("/" + documentName + "/swagger.json",
|
|
|
|
|
AppSetting.app(new string[] { "SwaggerDoc", "ContactName" }));
|
|
|
|
|
c.DocExpansion(DocExpansion.None);//DocExpansion设置为None可折叠所有方法
|
|
|
|
|
c.DefaultModelExpandDepth(-1);//-1 可不显示Models
|
|
|
|
|
});
|
|
|
|
|
//跨域
|
|
|
|
|
var policyName = AppSetting.app(new string[] { "Cors", "PolicyName" });
|
|
|
|
|
if (!policyName.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
app.UseCors(policyName); //添加跨域中间件
|
|
|
|
|
}
|
|
|
|
|
app.UsePublicMiddlewares();
|
|
|
|
|
//var documentName = AppSetting.app(new string[] { "SwaggerDoc", "ContactName" });
|
|
|
|
|
//app
|
|
|
|
|
// .UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; })
|
|
|
|
|
// .UseSwaggerUI(c =>
|
|
|
|
|
// {
|
|
|
|
|
// c.SwaggerEndpoint("/" + documentName + "/swagger.json",
|
|
|
|
|
// AppSetting.app(new string[] { "SwaggerDoc", "ContactName" }));
|
|
|
|
|
// c.DocExpansion(DocExpansion.None);//DocExpansion设置为None可折叠所有方法
|
|
|
|
|
// c.DefaultModelExpandDepth(-1);//-1 可不显示Models
|
|
|
|
|
// });
|
|
|
|
|
////跨域
|
|
|
|
|
//var policyName = AppSetting.app(new string[] { "Cors", "PolicyName" });
|
|
|
|
|
//if (!policyName.IsNullOrEmpty())
|
|
|
|
|
//{
|
|
|
|
|
// app.UseCors(policyName); //添加跨域中间件
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
app.UseRouting();
|
|
|
|
|
//app.UseRouting();
|
|
|
|
|
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
//多语言中间件
|
|
|
|
|
app.UseMiddleware<MultiLanguageMiddleware>();
|
|
|
|
|
// //操作日志中间件
|
|
|
|
|
// app.UseMiddleware<OperationLogMiddleware>();
|
|
|
|
|
//app.UseStaticFiles();
|
|
|
|
|
////多语言中间件
|
|
|
|
|
//app.UseMiddleware<MultiLanguageMiddleware>();
|
|
|
|
|
//// //操作日志中间件
|
|
|
|
|
//// app.UseMiddleware<OperationLogMiddleware>();
|
|
|
|
|
|
|
|
|
|
// 先开启认证
|
|
|
|
|
app.UseAuthentication();
|
|
|
|
|
// 然后是授权中间件
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
|
|
|
|
//// 先开启认证
|
|
|
|
|
//app.UseAuthentication();
|
|
|
|
|
//// 然后是授权中间件
|
|
|
|
|
//app.UseAuthorization();
|
|
|
|
|
//app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
|
|
|
|
|
|
|
|
|
app.Run();
|