Skip to content

Commit

Permalink
Chore: Adição de CORS para localhost:3000.
Browse files Browse the repository at this point in the history
  • Loading branch information
LibardiFelipe committed Oct 10, 2022
1 parent 31951fd commit 5ea9592
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions TemplateBase.WebAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
options.LowercaseUrls = true;
});

builder.Services.AddCors(opt =>
{
opt.AddPolicy("CorsPolicy", policy =>
{
policy
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials()
.WithOrigins("http:https://localhost:3000");
});
});

// Controllers
builder.Services.AddControllers();

Expand Down Expand Up @@ -123,4 +135,6 @@

app.MapControllers();

app.UseCors("CorsPolicy");

app.Run();

0 comments on commit 5ea9592

Please sign in to comment.