Merge branch 'bug/4-wwwroot-not-found'

This commit is contained in:
Leonid Pershin
2026-08-20 13:33:14 +03:00
5 changed files with 81 additions and 1 deletions
+10
View File
@@ -0,0 +1,10 @@
namespace HSchool.Server;
/// <summary>
/// Published images copy the Vite build into wwwroot. Local Aspire has no such folder.
/// </summary>
internal static class ClientStaticFiles
{
public static bool CanServe(string? webRootPath) =>
!string.IsNullOrEmpty(webRootPath) && Directory.Exists(webRootPath);
}
+5 -1
View File
@@ -159,7 +159,11 @@ app.Map("/ws/game", async (HttpContext context, GameSocketHandler handler, Sessi
app.MapDefaultEndpoints();
// In a published container the built client lands in wwwroot next to the server.
app.UseFileServer();
// Local Aspire has no such folder — Vite serves the UI, and UseFileServer would warn.
if (ClientStaticFiles.CanServe(app.Environment.WebRootPath))
{
app.UseFileServer();
}
app.Run();