Project Init
This commit is contained in:
@@ -10,6 +10,17 @@ builder.Services.AddProjectManagementModule(builder.Configuration);
|
||||
// Add controllers
|
||||
builder.Services.AddControllers();
|
||||
|
||||
// Configure CORS for frontend
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowFrontend", policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:3000")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
||||
// Configure OpenAPI/Scalar
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
@@ -25,6 +36,9 @@ if (app.Environment.IsDevelopment())
|
||||
// Global exception handler (should be first in pipeline)
|
||||
app.UseMiddleware<GlobalExceptionHandlerMiddleware>();
|
||||
|
||||
// Enable CORS
|
||||
app.UseCors("AllowFrontend");
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user