landing_page

This commit is contained in:
tistopandita
2026-06-11 15:01:02 +07:00
parent 5386300498
commit b350e4e2c8
2 changed files with 506 additions and 7 deletions
+15 -7
View File
@@ -13,6 +13,11 @@ const PORT = process.env.PORT || 3000;
app.use(cors());
app.use(express.json());
app.use("/api/poverty", povertyRoutes);
// ─── Root: landing page (harus sebelum express.static) ───────────────────────
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "../frontend/landing.html"));
});
// Sajikan folder frontend secara statis
app.use(express.static(path.join(__dirname, "../frontend")));
@@ -644,19 +649,22 @@ app.delete("/api/bangunan/:id", async (req, res) => {
}
});
// ─── Fallback: semua route non-API ke index.html ─────────────────────────────
// ─── Fallback: semua route non-API ke landing.html ───────────────────────────
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "../frontend/index.html"));
res.sendFile(path.join(__dirname, "../frontend/landing.html"));
});
// ─── Start ────────────────────────────────────────────────────────────────────
initDatabase().then(() => {
app.listen(PORT, () => {
console.log(`\n🚀 Server berjalan di http://localhost:${PORT}`);
console.log(` Peta → http://localhost:${PORT}/`);
console.log(` Admin → http://localhost:${PORT}/admin.html`);
console.log(` API → http://localhost:${PORT}/api/spbu`);
console.log(` API → http://localhost:${PORT}/api/jalan`);
console.log(` API → http://localhost:${PORT}/api/bangunan\n`);
console.log(` Portal → http://localhost:${PORT}/`);
console.log(` SPBU → http://localhost:${PORT}/index.html`);
console.log(` Poverty → http://localhost:${PORT}/poverty-map.html`);
console.log(` Pengajuan → http://localhost:${PORT}/pengajuan.html`);
console.log(` Admin → http://localhost:${PORT}/admin.html`);
console.log(` Admin POV → http://localhost:${PORT}/admin-poverty.html`);
console.log(` API SPBU → http://localhost:${PORT}/api/spbu`);
console.log(` API POV → http://localhost:${PORT}/api/poverty\n`);
});
});