Project Init
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled

This commit is contained in:
Yaojia Wang
2025-11-03 00:04:19 +01:00
parent 014d62bcc2
commit 8caf8c1bcf
7 changed files with 276 additions and 1 deletions

View File

@@ -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();