You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Program.cs 900B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using BlackRock.Reporting.API.Core;
  2. using BlackRock.Reporting.API.Persistence;
  3. var builder = WebApplication.CreateBuilder(args);
  4. // Add services to the container.
  5. builder.Services.AddCors();
  6. builder.Services.AddControllers();
  7. builder.Services.AddScoped<IGenerator,PdfGenerator>();
  8. builder.Services.AddSwaggerGen(c =>
  9. {
  10. c.SwaggerDoc("v1", new() { Title = "BlackRock.Reporting.API", Version = "v1" });
  11. });
  12. var app = builder.Build();
  13. // Configure the HTTP request pipeline.
  14. app.UseCors(options =>
  15. options.AllowAnyHeader()
  16. .AllowAnyMethod()
  17. .AllowAnyOrigin()
  18. );
  19. if (app.Environment.IsDevelopment())
  20. {
  21. app.UseSwagger();
  22. app.UseSwaggerUI(c => {
  23. c.SwaggerEndpoint("/swagger/v1/swagger.json", "BlackRock.Reporting.API v1");
  24. c.RoutePrefix = string.Empty;});
  25. }
  26. app.UseHttpsRedirection();
  27. app.UseAuthorization();
  28. app.MapControllers();
  29. app.Run();