Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (46 loc) · 1.85 KB
/
Copy pathProgram.cs
File metadata and controls
54 lines (46 loc) · 1.85 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Hangfire;
using Amazon.S3;
using FluentValidation;
using ArtUnion_API.Data;
using ArtUnion_API.Configs;
using ArtUnion_API.Services.Interfaces;
using ArtUnion_API.Services.Implementation;
var builder = WebApplication.CreateBuilder(args);
DotNetEnv.Env.Load();
builder.Services.AddCustomJsonOptions();
builder.Services.AddHttpContextAccessor();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwagger();
builder.Services.AddAWSService<IAmazonS3>();
builder.Services.AddScoped<IAuthService, AuthService>();
builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddScoped<IPortfolioService, PortfolioService>();
builder.Services.AddScoped<IArtworkService, ArtworkService>();
builder.Services.AddScoped<ICategoryService, CategoryService>();
builder.Services.AddScoped<ICritiqueService, CritiqueService>();
builder.Services.AddScoped<ISubscriptionService, SubscriptionService>();
builder.Services.AddScoped<IJwtService, JwtService>();
builder.Services.AddScoped<IEmailService, EmailService>();
builder.Services.AddScoped<IAmazonS3Service, AmazonS3Service>();
builder.Services.AddScoped<IWeeklyDigestService, WeeklyDigestService>();
builder.Services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
builder.Services.AddDbContext<DataContext>();
builder.Services.AddAutoMapper(typeof(Program).Assembly);
builder.Services.AddValidatorsFromAssemblyContaining<Program>();
builder.Services.AddJwtBearerAuthentication();
builder.Services.AddAuthorizationConfiguration();
builder.Services.AddHangfireConfiguration();
builder.Configuration.AddEnvironmentVariables();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.ConfigureRecurringJobs();
app.UseHangfireDashboard();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();