Skip to content

Commit

Permalink
Adding cors
Browse files Browse the repository at this point in the history
Adding cors middleware for allowing requests to itself
  • Loading branch information
UO289930 committed Mar 11, 2024
1 parent 16ee107 commit 327e6ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions wikidata_service/WikiDataTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
builder.Services.AddSingleton(new WikiDataService());
builder.Services.AddSingleton(new QuestionService());

builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", policy =>
{
policy.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});

var app = builder.Build();

Expand All @@ -24,6 +33,8 @@

app.UseHttpsRedirection();

app.UseCors("AllowAll");

app.UseAuthorization();

app.MapControllers();
Expand Down
1 change: 0 additions & 1 deletion wikidata_service/WikiDataTest/Services/WikiDataService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using WikiDataTest.Controllers;
using WikiDataTest.Models;

namespace WikiDataTest.Services
Expand Down

0 comments on commit 327e6ec

Please sign in to comment.