aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.ServiceViewer/Program.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-10-21 15:34:24 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-12-12 10:24:53 +0100
commit661cccc2da9a6c32b7b56c60313787282a9084ea (patch)
tree8176720aa99b80281a8351ae74170238c50b59cc /src/Costasdev.Busurbano.ServiceViewer/Program.cs
parented023a4b5ee257c0c367357b6d83f9778e2cf536 (diff)
Begin implementing
Diffstat (limited to 'src/Costasdev.Busurbano.ServiceViewer/Program.cs')
-rw-r--r--src/Costasdev.Busurbano.ServiceViewer/Program.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Costasdev.Busurbano.ServiceViewer/Program.cs b/src/Costasdev.Busurbano.ServiceViewer/Program.cs
new file mode 100644
index 0000000..285afc2
--- /dev/null
+++ b/src/Costasdev.Busurbano.ServiceViewer/Program.cs
@@ -0,0 +1,32 @@
+using Costasdev.ServiceViewer;
+using Costasdev.ServiceViewer.Data;
+using Microsoft.EntityFrameworkCore;
+
+var builder = WebApplication.CreateBuilder(args);
+
+builder.Services.AddControllersWithViews();
+
+builder.Services.AddDbContext<AppDbContext>(db =>
+{
+ var connectionString = builder.Configuration.GetConnectionString("Database");
+ if (string.IsNullOrEmpty(connectionString))
+ {
+ throw new InvalidOperationException("Connection string 'Database' is not configured.");
+ }
+ db.UseMySQL(connectionString);
+});
+
+builder.Services.AddHttpClient();
+builder.Services.AddMemoryCache();
+
+var app = builder.Build();
+
+app.UseHttpsRedirection();
+app.UseRouting();
+
+app.UseStaticFiles();
+app.MapStaticAssets();
+
+app.MapControllers();
+
+app.Run();