diff --git a/backend/README.md b/backend/README.md index 9967549..b1255fd 100644 --- a/backend/README.md +++ b/backend/README.md @@ -16,6 +16,7 @@ To run in development mode, you will need: ### Running locally To run in development mode, run: ```sh +cd YPS.Beer/ dotnet run ``` diff --git a/backend/YPS.Beer/Program.cs b/backend/YPS.Beer/Program.cs index 774f981..e94f5fc 100644 --- a/backend/YPS.Beer/Program.cs +++ b/backend/YPS.Beer/Program.cs @@ -29,7 +29,10 @@ builder.Services.AddAuthentication(IdentityConstants.ApplicationScheme) .AddApplicationCookie(); builder.Services.AddAuthorizationBuilder(); -builder.Services.AddCors(); +builder.Services.AddCors(options => +{ + options.AddDefaultPolicy(policy => policy.WithOrigins("http://localhost:3000").AllowAnyMethod().AllowAnyHeader().AllowCredentials()); +}); var app = builder.Build(); @@ -37,12 +40,16 @@ if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); - - app.UseCors(cors => cors.AllowAnyHeader().AllowAnyMethod().SetIsOriginAllowed(_ => true).AllowCredentials()); } +app.UseRouting(); + app.UseHttpsRedirection(); +app.UseCors(); + +app.UseAuthorization(); + app.MapControllers(); app.MapIdentityApi();