diff --git a/backend/Api/Program.cs b/backend/Api/Program.cs index de998ca..5490e59 100644 --- a/backend/Api/Program.cs +++ b/backend/Api/Program.cs @@ -2,14 +2,14 @@ using Api; using Microsoft.AspNetCore; using Microsoft.EntityFrameworkCore; -public class Program -{ - private static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); - } - // Calls the startup class and creates the webinterface - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); -} \ No newline at end of file +var app = WebHost.CreateDefaultBuilder(args) + .UseUrls("http://0.0.0.0:5000") + .UseStartup() + .Build(); + +await using var scope = app.Services.CreateAsyncScope(); +await using var db = scope.ServiceProvider.GetService(); +await db.Database.MigrateAsync(); + +app.Run(); +