Skip to content

Commit

Permalink
🔧 feat: adding support to CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigolira committed Nov 4, 2020
1 parent 553f83e commit 8668003
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/DevTranslate.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ public void ConfigureServices(IServiceCollection services)
}
);

services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder
.AllowAnyOrigin()
.AllowAnyMethod();
});
});

services.AddDbContext<DevTranslateContext>(options =>
{
options.UseMySql(Configuration.GetConnectionString("DevTranslateConnectionString"), mySqlOptions =>
Expand Down Expand Up @@ -67,6 +77,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

app.UseRouting();

app.UseCors();

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
Expand Down

0 comments on commit 8668003

Please sign in to comment.