We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e787438 commit a601d72Copy full SHA for a601d72
Program.cs
@@ -6,6 +6,17 @@
6
builder.Services.AddDbContext<AppDbContext>(options =>
7
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
8
9
+// Add CORS configuration
10
+builder.Services.AddCors(options =>
11
+{
12
+ options.AddDefaultPolicy(policy =>
13
+ {
14
+ policy.AllowAnyOrigin()
15
+ .AllowAnyHeader()
16
+ .AllowAnyMethod();
17
+ });
18
+});
19
+
20
builder.Services.AddControllers();
21
builder.Services.AddEndpointsApiExplorer();
22
builder.Services.AddSwaggerGen();
@@ -35,6 +46,9 @@
35
46
app.UseSwaggerUI();
36
47
}
37
48
49
+// Use CORS
50
+app.UseCors();
51
38
52
app.UseAuthorization();
39
53
40
54
app.MapControllers();
0 commit comments