fix: serve index.html instead of page.html

This commit is contained in:
2025-06-04 10:56:56 +09:00
parent fb8498fa3d
commit b5770b4301

View File

@ -104,37 +104,37 @@ app.get("/podcast.xml", async (c) => {
// フォールバックとして index.htmlルートパス // フォールバックとして index.htmlルートパス
app.get("/", async (c) => { app.get("/", async (c) => {
const indexPath = path.join(frontendBuildDir, "server", "app", "page.html"); const indexPath = path.join(frontendBuildDir, "server", "app", "index.html");
const file = Bun.file(indexPath); const file = Bun.file(indexPath);
if (await file.exists()) { if (await file.exists()) {
console.log(`Serving page.html from ${indexPath}`); console.log(`Serving index.html from ${indexPath}`);
return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" }); return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" });
} }
console.error(`page.html not found at ${indexPath}`); console.error(`index.html not found at ${indexPath}`);
return c.notFound(); return c.notFound();
}); });
// フォールバックとして index.html明示的なパス // フォールバックとして index.html明示的なパス
app.get("/index.html", async (c) => { app.get("/index.html", async (c) => {
const indexPath = path.join(frontendBuildDir, "server", "app", "page.html"); const indexPath = path.join(frontendBuildDir, "server", "app", "index.html");
const file = Bun.file(indexPath); const file = Bun.file(indexPath);
if (await file.exists()) { if (await file.exists()) {
console.log(`Serving page.html from ${indexPath}`); console.log(`Serving index.html from ${indexPath}`);
return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" }); return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" });
} }
console.error(`page.html not found at ${indexPath}`); console.error(`index.html not found at ${indexPath}`);
return c.notFound(); return c.notFound();
}); });
// その他のパスも page.html へフォールバック // その他のパスも index.html へフォールバック
app.get("*", async (c) => { app.get("*", async (c) => {
const indexPath = path.join(frontendBuildDir, "server", "app", "page.html"); const indexPath = path.join(frontendBuildDir, "server", "app", "index.html");
const file = Bun.file(indexPath); const file = Bun.file(indexPath);
if (await file.exists()) { if (await file.exists()) {
console.log(`Serving page.html from ${indexPath}`); console.log(`Serving index.html from ${indexPath}`);
return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" }); return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" });
} }
console.error(`page.html not found at ${indexPath}`); console.error(`index.html not found at ${indexPath}`);
return c.notFound(); return c.notFound();
}); });