Enable CORS for the API
This commit is contained in:
parent
d416f39b36
commit
e0a93ba608
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -30,6 +30,7 @@ namespace PluralKit.API
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.AddCors();
|
||||||
services.AddMvc(opts => { })
|
services.AddMvc(opts => { })
|
||||||
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
|
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
|
||||||
.AddJsonOptions(opts => { opts.SerializerSettings.BuildSerializerSettings(); });
|
.AddJsonOptions(opts => { opts.SerializerSettings.BuildSerializerSettings(); });
|
||||||
@ -60,6 +61,7 @@ namespace PluralKit.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
//app.UseHttpsRedirection();
|
//app.UseHttpsRedirection();
|
||||||
|
app.UseCors(opts => opts.AllowAnyMethod().AllowAnyOrigin());
|
||||||
app.UseMiddleware<TokenAuthService>();
|
app.UseMiddleware<TokenAuthService>();
|
||||||
app.UseMvc();
|
app.UseMvc();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user