DeepDrftWeb startup & setup

This commit is contained in:
2025-08-30 22:02:29 -04:00
parent 3a11c75e5a
commit 91ab145b85
4 changed files with 53 additions and 5 deletions
+10 -4
View File
@@ -1,12 +1,19 @@
using DeepDrftWeb;
using MudBlazor.Services;
using DeepDrftWeb.Client.Pages;
using DeepDrftWeb.Components;
using DeepDrftWeb.Data;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Add MudBlazor services
builder.Services.AddMudServices();
Startup.ConfigureDomainServices(builder);
builder.Services.AddControllers();
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
@@ -24,14 +31,13 @@ else
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.UseHttpsRedirection();
app.UseAntiforgery();
app.MapStaticAssets();
app.MapControllers();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
+21
View File
@@ -0,0 +1,21 @@
using DeepDrftWeb.Data;
using DeepDrftWeb.Data.Repositories;
using DeepDrftWeb.Services;
using Microsoft.EntityFrameworkCore;
namespace DeepDrftWeb;
public static class Startup
{
public static void ConfigureDomainServices(WebApplicationBuilder builder)
{
// Add Entity Framework services
builder.Services.AddDbContext<DeepDrftContext>(options =>
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection")));
// Add Track services
builder.Services.AddScoped<TrackRepository>();
builder.Services.AddScoped<TrackService>();
}
}
+4 -1
View File
@@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Data Source=deepdrft.db"
}
}