Skip to content

Commit

Permalink
more cors
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-w4tch3r committed Jun 26, 2024
1 parent ff634f6 commit f7c36d8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions server/SuperchartBackend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,31 @@
builder.Services.AddScoped<Repository>();
builder.Services.AddScoped<ChartNameHandler>();

builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(
// options.AddPolicy("AllowAll",
b =>
{
b.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddOpenApiDocument(ConfigureOpenApiDocs);
builder.Services.AddScoped<SwaggerBasicAuthMiddleware>();

var app = builder.Build();
// app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseCors();
app.MapControllers();
app.UseMiddleware<SwaggerBasicAuthMiddleware>();
app.UseOpenApi();
app.UseSwaggerUi(ConfigureSwaggerUI);
// app.UseHttpsRedirection();
app.MapControllers();
if (app.Environment.IsDevelopment())
app.UseDeveloperExceptionPage();

Expand Down

0 comments on commit f7c36d8

Please sign in to comment.