Skip to content

Commit

Permalink
Merge pull request #13 from fga-eps-mds/hotfix/cors
Browse files Browse the repository at this point in the history
Correção do CORS
  • Loading branch information
DenysRogeres authored May 27, 2023
2 parents c5688ea + 495cb8f commit aae722d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using app.DI;
using dominio.Mapper;
using Microsoft.OpenApi.Models;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

builder.Services.AddAutoMapper(typeof(AutoMapperConfig));

builder.Services.AddEndpointsApiExplorer();

builder.Services.AddSwaggerGen(options =>
Expand All @@ -24,9 +27,20 @@

builder.Services.AddContexto(builder.Configuration);

builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAllOrigins",
builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});

var app = builder.Build();

app.UseCors("All");
app.UseCors("AllowAllOrigins");

app.UseSwagger();

Expand Down

0 comments on commit aae722d

Please sign in to comment.