-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
28 lines (24 loc) · 850 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Main;
using Main.Middlewares;
var builder = WebApplication.CreateBuilder(args);
builder.SetAuthentication();
builder.SetCors();
builder.SupressInvalidFilter();
builder.AddBlobServiceClient();
builder.Services.AddAutoMapper(typeof(Program));
builder.Services.AddDbContext<Context>();
builder.Services.AddExceptionHandler<GlobalExceptionHandler>();
builder.Services.AddProblemDetails();
builder.Services.AddHttpContextAccessor();
builder.Services.AddControllers().AddNewtonsoftJson(options =>
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
);
builder.Services.AddAuthorization();
var app = builder.Build();
app.UseCors();
app.UseAuthorization();
app.MapControllers();
app.UseExceptionHandler();
app.Run();