aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Experimental.ServiceViewer/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Enmarcha.Experimental.ServiceViewer/Program.cs')
-rw-r--r--src/Enmarcha.Experimental.ServiceViewer/Program.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Enmarcha.Experimental.ServiceViewer/Program.cs b/src/Enmarcha.Experimental.ServiceViewer/Program.cs
new file mode 100644
index 0000000..952b273
--- /dev/null
+++ b/src/Enmarcha.Experimental.ServiceViewer/Program.cs
@@ -0,0 +1,35 @@
+using Enmarcha.Experimental.ServiceViewer;
+using Enmarcha.Experimental.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.UseNpgsql(connectionString, npg =>
+ {
+ npg.UseNetTopologySuite();
+ });
+});
+
+builder.Services.AddHttpClient();
+builder.Services.AddMemoryCache();
+
+var app = builder.Build();
+
+app.UseHttpsRedirection();
+app.UseRouting();
+
+app.UseStaticFiles();
+app.MapStaticAssets();
+
+app.MapControllers();
+
+app.Run();