Merge branch 'bug/4-wwwroot-not-found'
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user