Skip to content

Commit

Permalink
chore(cors): add cors config
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhck committed Jul 28, 2020
1 parent 7634943 commit a2f9759
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Feature.Manager.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public void ConfigureServices(IServiceCollection services)
{
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});
services.SetupCors(Configuration.GetSection("CorsConfig").Get<CorsConfig>());
services.ConfigureSwagger();
services.RegisterWorker();
services.SetupCors(Configuration.GetSection("CorsConfig").Get<CorsConfig>());
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand All @@ -42,8 +42,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IOptions
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseCorsPolicy(corsConfig.Value);
app.UseRouting();
app.UseAuthorization();
app.AddSwaggerWithUi();
app.UseEndpoints(endpoints =>
Expand Down
1 change: 1 addition & 0 deletions Feature.Manager.Api/StartupExtensions/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class Configuration
public static void AddConfiguration(this IServiceCollection services, IConfiguration configuration)
{
services.Configure<DatabaseConfig>(configuration.GetSection("DatabaseConfig"));
services.Configure<CorsConfig>(configuration.GetSection("CorsConfig"));
}
}
}

0 comments on commit a2f9759

Please # to comment.