72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
|
||
using Learn.VideoAnalysis.API.Expand;
|
||
using Mapster;
|
||
using Microsoft.OpenApi.Models;
|
||
using VideoAnalysisCore.AICore.GPT.DeepSeek;
|
||
using VideoAnalysisCore.Common;
|
||
using VideoAnalysisCore.Common.Expand;
|
||
|
||
namespace Learn.VideoAnalysis.API
|
||
{
|
||
public class Program
|
||
{
|
||
public static void Main(string[] args)
|
||
{
|
||
var builder = WebApplication.CreateBuilder(args);
|
||
|
||
// 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(c =>
|
||
{
|
||
var file = Path.Combine(AppContext.BaseDirectory, "Learn.VideoAnalysis.API.xml"); // xml文档绝对路径
|
||
c.IncludeXmlComments(file, true); // true : 显示控制器层注释
|
||
c.OrderActionsBy(o => o.RelativePath); // 对action的名称进行排序,如果有多个,就可以看见效果了。
|
||
});
|
||
|
||
|
||
builder.Services.AddMapster();
|
||
|
||
//初始化 插件
|
||
builder.Configuration.AddAppConfig(args);
|
||
|
||
builder.Services.AddSqlSugarExpand();
|
||
builder.Services.AddRedisExpand();
|
||
builder.Services.AddCoravel();
|
||
builder.Services.AddCorsExpand();
|
||
builder.Services.AddHttpContextAccessor();
|
||
builder.Services.AddControllersWithViews(options =>
|
||
{
|
||
options.Filters.Add(typeof(ExceptionFilter));
|
||
});
|
||
|
||
|
||
var app = builder.Build();
|
||
AppCommon.Services = app.Services;
|
||
// Configure the HTTP request pipeline.
|
||
if (app.Environment.IsDevelopment())
|
||
{
|
||
app.UseSwagger();
|
||
app.UseSwaggerUI();
|
||
}
|
||
|
||
app.UseHttpsRedirection();
|
||
|
||
app.UseAuthorization();
|
||
|
||
|
||
app.MapControllers();
|
||
|
||
//自定义 应用
|
||
app.UseCorsExpand();
|
||
app.UseSqlSugarExpand();
|
||
app.UseCoravelExpand();
|
||
|
||
|
||
app.Run();
|
||
}
|
||
}
|
||
}
|