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