40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using WebServer.Components;
|
|
using PythonInterop;
|
|
using DataBase;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Load the module in globally and use correct path for local or docker runners
|
|
#if DEBUG
|
|
AIModule interopModule = new AIModule(PythonPathBase: "/usr/", PythonVersion: "python3.11");
|
|
#else
|
|
AIModule interopModule = new AIModule();
|
|
#endif
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
|
|
|
|
// Insert the DB driver for Dependency Injection
|
|
builder.Services.AddSingleton<DbDriver>();
|
|
|
|
// Insert the python modlue for Dependency Injection
|
|
builder.Services.AddSingleton(interopModule);
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment()) {
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAntiforgery();
|
|
|
|
app.MapStaticAssets();
|
|
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|