source: ChapterX.API/Program.cs@ 877c13c

main
Last change on this file since 877c13c was 877c13c, checked in by kikisrbinoska <srbinoskakristina07@…>, 4 months ago

Added files

  • Property mode set to 100644
File size: 989 bytes
RevLine 
[877c13c]1using ChapterX.Application;
2using ChapterX.Infrastructure;
3using System.Reflection;
4
5var builder = WebApplication.CreateBuilder(args);
6
7builder.Services.AddControllers();
8builder.Services.AddEndpointsApiExplorer();
9builder.Services.AddSwaggerGen(options =>
10{
11 options.CustomSchemaIds(type => type.FullName);
12});
13
14builder.Services.AddAuthentication();
15builder.Services.AddAuthorization();
16
17builder.Services.AddApplication();
18builder.Services.AddInfrastructure(builder.Configuration);
19
20var app = builder.Build();
21
22if (app.Environment.IsDevelopment())
23{
24 app.UseSwagger();
25 app.UseSwaggerUI();
26}
27
28app.UseHttpsRedirection();
29app.UseAuthentication();
30app.UseAuthorization();
31try
32{
33 app.MapControllers();
34}
35catch (ReflectionTypeLoadException ex)
36{
37 Console.Error.WriteLine("ReflectionTypeLoadException while mapping controllers:");
38 foreach (var loaderEx in ex.LoaderExceptions ?? [])
39 {
40 Console.Error.WriteLine(loaderEx.ToString());
41 }
42
43 throw;
44}
45
46app.Run();
Note: See TracBrowser for help on using the repository browser.