111
This commit is contained in:
parent
e646d86004
commit
7c2420a00b
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -38,3 +38,4 @@ dist/
|
|||
*.air
|
||||
*.ipa
|
||||
*.apk
|
||||
/src/frontend/package-lock.json
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
using System.Text;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
using MilitaryTrainingManagement.Authorization;
|
||||
using MilitaryTrainingManagement.Data;
|
||||
using MilitaryTrainingManagement.Models.Enums;
|
||||
|
|
@ -119,6 +121,7 @@ builder.Services.AddSwaggerGen(c =>
|
|||
});
|
||||
|
||||
// 配置CORS
|
||||
#if DEBUG
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowAll", policy =>
|
||||
|
|
@ -128,18 +131,19 @@ builder.Services.AddCors(options =>
|
|||
.AllowAnyHeader();
|
||||
});
|
||||
});
|
||||
|
||||
#endif
|
||||
var app = builder.Build();
|
||||
|
||||
// 配置HTTP请求管道
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
#if DEBUG
|
||||
app.UseCors("AllowAll");
|
||||
#endif
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user