Skip to content
Snippets Groups Projects
Commit 46660934 authored by Adiv Asif's avatar Adiv Asif
Browse files

Merged PR 16: using cors now

using cors now
parents 071d4be0 4ab06cf4
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