import express from "express"; import path from "path"; import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const app = express(); const PORT = process.env.PORT || 80; // JSON 파싱 app.use(express.json()); // 정적 파일 서빙 (프론트엔드 빌드 결과물) app.use(express.static(path.join(__dirname, "dist"))); // API 라우트 (추후 구현) app.get("/api/health", (req, res) => { res.json({ status: "ok", timestamp: new Date().toISOString() }); }); // SPA 폴백 - 모든 요청을 index.html로 app.get("*", (req, res) => { res.sendFile(path.join(__dirname, "dist", "index.html")); }); app.listen(PORT, () => { console.log(`🌸 fromis_9 서버가 포트 ${PORT}에서 실행 중입니다`); });