Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

HostConfigurationExtension.cs 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. namespace Diligent.WebAPI.Host.Extensions
  2. {
  3. public static class HostConfigurationExtension
  4. {
  5. /// <summary>
  6. /// Services configuration
  7. /// </summary>
  8. public static void ConfigureHost(this WebApplicationBuilder builder)
  9. {
  10. builder.ConfigureAuth();
  11. builder.ConfigureIdentity();
  12. builder.ConfigureValidationMiddleware();
  13. builder.ConfigureSwagger();
  14. IServiceCollection services = builder.Services;
  15. services.AddControllers();
  16. services.AddEndpointsApiExplorer();
  17. }
  18. /// <summary>
  19. /// App configuration
  20. /// </summary>
  21. public static void ConfigureHost(this WebApplication app)
  22. {
  23. app.UseCorrelationId();
  24. app.MapControllers();
  25. app.SetupData();
  26. // custom jwt auth middleware
  27. app.UseMiddleware<JwtMiddleware>();
  28. app.UseDiligExceptionHandler();
  29. app.ConfigureSwagger();
  30. }
  31. }
  32. }