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
|
| Rev | Line | |
|---|
| [877c13c] | 1 | using ChapterX.Application;
|
|---|
| 2 | using ChapterX.Infrastructure;
|
|---|
| 3 | using System.Reflection;
|
|---|
| 4 |
|
|---|
| 5 | var builder = WebApplication.CreateBuilder(args);
|
|---|
| 6 |
|
|---|
| 7 | builder.Services.AddControllers();
|
|---|
| 8 | builder.Services.AddEndpointsApiExplorer();
|
|---|
| 9 | builder.Services.AddSwaggerGen(options =>
|
|---|
| 10 | {
|
|---|
| 11 | options.CustomSchemaIds(type => type.FullName);
|
|---|
| 12 | });
|
|---|
| 13 |
|
|---|
| 14 | builder.Services.AddAuthentication();
|
|---|
| 15 | builder.Services.AddAuthorization();
|
|---|
| 16 |
|
|---|
| 17 | builder.Services.AddApplication();
|
|---|
| 18 | builder.Services.AddInfrastructure(builder.Configuration);
|
|---|
| 19 |
|
|---|
| 20 | var app = builder.Build();
|
|---|
| 21 |
|
|---|
| 22 | if (app.Environment.IsDevelopment())
|
|---|
| 23 | {
|
|---|
| 24 | app.UseSwagger();
|
|---|
| 25 | app.UseSwaggerUI();
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | app.UseHttpsRedirection();
|
|---|
| 29 | app.UseAuthentication();
|
|---|
| 30 | app.UseAuthorization();
|
|---|
| 31 | try
|
|---|
| 32 | {
|
|---|
| 33 | app.MapControllers();
|
|---|
| 34 | }
|
|---|
| 35 | catch (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 |
|
|---|
| 46 | app.Run();
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.