diff --git a/Feature.Manager.Api/Startup.cs b/Feature.Manager.Api/Startup.cs index 6caf674..57e3146 100644 --- a/Feature.Manager.Api/Startup.cs +++ b/Feature.Manager.Api/Startup.cs @@ -30,9 +30,9 @@ public void ConfigureServices(IServiceCollection services) { x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); }); - services.SetupCors(Configuration.GetSection("CorsConfig").Get()); services.ConfigureSwagger(); services.RegisterWorker(); + services.SetupCors(Configuration.GetSection("CorsConfig").Get()); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -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 => diff --git a/Feature.Manager.Api/StartupExtensions/Configuration.cs b/Feature.Manager.Api/StartupExtensions/Configuration.cs index 5e685c1..d1f71d0 100644 --- a/Feature.Manager.Api/StartupExtensions/Configuration.cs +++ b/Feature.Manager.Api/StartupExtensions/Configuration.cs @@ -9,6 +9,7 @@ public static class Configuration public static void AddConfiguration(this IServiceCollection services, IConfiguration configuration) { services.Configure(configuration.GetSection("DatabaseConfig")); + services.Configure(configuration.GetSection("CorsConfig")); } } }