forked from MDCPS/DamageAssessment_Backend
Updat for CORS Resolution
This commit is contained in:
@ -6,6 +6,11 @@ using System.Reflection;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// CORS setup to allow requests from any origin.
|
||||
builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
|
||||
build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
|
||||
}));
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
@ -36,6 +41,9 @@ if (app.Environment.IsDevelopment())
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
|
||||
// Enable CORS, authentication, and authorization middleware.
|
||||
app.UseCors("DamageAppCorsPolicy");
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
Reference in New Issue
Block a user