Spaces:
Runtime error
Runtime error
Florin Bobiș
commited on
Commit
•
0e97e34
1
Parent(s):
cb1e135
test
Browse files- Program.cs +11 -1
Program.cs
CHANGED
@@ -11,6 +11,16 @@ builder.WebHost.ConfigureKestrel(serverOptions =>
|
|
11 |
builder.Services.AddDbContext<QuoteDbContext>(options =>
|
12 |
options.UseSqlite("Data Source=quotes.db"));
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
builder.Services.AddEndpointsApiExplorer();
|
15 |
builder.Services.AddSwaggerGen();
|
16 |
|
@@ -25,7 +35,7 @@ var app = builder.Build();
|
|
25 |
|
26 |
const int MaxPageSize = 100;
|
27 |
|
28 |
-
app.
|
29 |
|
30 |
app.MapGet("/quotes", async (QuoteDbContext db, int pageNumber = 1, int pageSize = 10) =>
|
31 |
{
|
|
|
11 |
builder.Services.AddDbContext<QuoteDbContext>(options =>
|
12 |
options.UseSqlite("Data Source=quotes.db"));
|
13 |
|
14 |
+
builder.Services.AddCors(options =>
|
15 |
+
{
|
16 |
+
options.AddPolicy(name: "CorsPolicy", builder =>
|
17 |
+
{
|
18 |
+
builder.AllowAnyOrigin()
|
19 |
+
.AllowAnyHeader()
|
20 |
+
.AllowAnyMethod();
|
21 |
+
});
|
22 |
+
});
|
23 |
+
|
24 |
builder.Services.AddEndpointsApiExplorer();
|
25 |
builder.Services.AddSwaggerGen();
|
26 |
|
|
|
35 |
|
36 |
const int MaxPageSize = 100;
|
37 |
|
38 |
+
app.UseCors();
|
39 |
|
40 |
app.MapGet("/quotes", async (QuoteDbContext db, int pageNumber = 1, int pageSize = 10) =>
|
41 |
{
|