Add cors policy
This commit is contained in:
@@ -9,6 +9,11 @@ builder.Services.AddControllers();
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
builder.Services.AddCors(option => option.AddDefaultPolicy(policy =>
|
||||
policy.WithOrigins("http://localhost:5172")
|
||||
.AllowAnyHeader()
|
||||
.WithMethods("GET", "POST")));
|
||||
|
||||
builder.Services.AddSingleton<TranslationService>();
|
||||
builder.Services.AddSingleton<Translations>();
|
||||
|
||||
@@ -32,9 +37,9 @@ foreach (var file in translationFiles)
|
||||
}
|
||||
|
||||
app.Services.GetRequiredService<TranslationService>().Initialize(dictionary);
|
||||
var resourcesKey = app.Services.GetRequiredService<Translations>();
|
||||
ResourcesKey.Initialize(resourcesKey);
|
||||
ResourcesKey.Initialize(app.Services.GetRequiredService<Translations>());
|
||||
|
||||
app.UseCors();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
Reference in New Issue
Block a user