Skip to content

Commit bafaca6

Browse files
committed
add CORS to example app
1 parent 33991b8 commit bafaca6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

JsonApiDotNetCoreExample/Startup.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public Startup(IHostingEnvironment env)
3232
public void ConfigureServices(IServiceCollection services)
3333
{
3434
// Add framework services.
35-
services.AddMvc();
35+
services.AddCors();
36+
3637
services.AddDbContext<ApplicationDbContext>(options =>
3738
options.UseNpgsql(Configuration["Data:ConnectionString"]),
3839
ServiceLifetime.Transient);
@@ -54,6 +55,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
5455
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
5556
loggerFactory.AddDebug();
5657

58+
app.UseCors(builder =>
59+
builder.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyMethod().AllowCredentials());
60+
5761
app.UseJsonApi();
5862
}
5963
}

0 commit comments

Comments
 (0)