feat: add GreenHome web frontend and weather dashboard
This commit is contained in:
@@ -31,6 +31,9 @@ ConfigureMiddleware(app);
|
||||
ConfigureStaticFiles(app);
|
||||
app.MapControllers();
|
||||
|
||||
// SPA fallback: serve index.html for non-API routes (client-side routing)
|
||||
app.MapFallbackToFile("index.html");
|
||||
|
||||
app.Run();
|
||||
|
||||
// ============================================================
|
||||
@@ -43,6 +46,10 @@ void ConfigureCoreServices(WebApplicationBuilder builder)
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
// Caching & HTTP client factory (used by WeatherController proxy with tiered caching)
|
||||
builder.Services.AddMemoryCache();
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
builder.Services.AddAutoMapper(typeof(GreenHome.Application.MappingProfile));
|
||||
builder.Services.AddValidatorsFromAssemblyContaining<GreenHome.Application.DeviceDtoValidator>();
|
||||
|
||||
@@ -146,4 +153,8 @@ void ConfigureStaticFiles(WebApplication app)
|
||||
RequestPath = "/files",
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
|
||||
// Serve the SPA from wwwroot (Vite build output)
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user