Fix programs
This commit is contained in:
@@ -16,10 +16,15 @@ var services = builder.Services;
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
#if DEBUG
|
||||
UriBuilder uriBuilder = new(builder.HostEnvironment.BaseAddress)
|
||||
{
|
||||
Port = 8000
|
||||
};
|
||||
#else
|
||||
UriBuilder uriBuilder = new(Environment.GetEnvironmentVariable("API_URL")
|
||||
?? throw new ArgumentNullException("API_URL", "Environment variable API_URL is missing"));
|
||||
#endif
|
||||
|
||||
services.AddHttpClient(
|
||||
"GameIdeas.WebAPI",
|
||||
|
||||
@@ -89,12 +89,18 @@ services.AddControllers();
|
||||
services.AddOpenApi();
|
||||
|
||||
services.AddCors(option => option.AddDefaultPolicy(policy =>
|
||||
policy.WithOrigins("http://localhost:5172", "http://localhost:7060")
|
||||
policy.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.WithMethods("GET", "POST", "PUT", "DELETE")));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<GameIdeasContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
}
|
||||
|
||||
await LoadTranslations();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
Reference in New Issue
Block a user