Skip to content
Snippets Groups Projects
Commit 4ab06cf4 authored by Adiv's avatar Adiv
Browse files

using cors now

parent 071d4be0
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,18 @@ builder.Services.AddSingleton(mapper);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(
corsPolicyBuilder =>
{
corsPolicyBuilder.WithOrigins(builder.Configuration.GetSection("Group17Website")["BaseUrl"] ?? string.Empty)
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
// Add repositories in /Repositories
builder.Services.AddTransient(typeof(IBaseRepository<>), typeof(BaseRepository<>));
......@@ -41,6 +53,8 @@ if (app.Environment.IsDevelopment())
app.UseSwaggerUI();
}
app.UseCors();
app.UseHttpsRedirection();
app.UseAuthorization();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment