const express = require("express"); const path = require("path"); const app = express(); const PORT = process.env.PORT || 7860; // HF Spaces default app.use(express.json()); app.use(express.static(path.join(__dirname, "public"))); // Spotify now-playing endpoint — gracefully returns not-playing when no Spotify token is available app.get("/api/now-playing", (req, res) => { // On HF Spaces, the Spotify connector isn't available. // This endpoint exists so the frontend doesn't error — it just reports nothing playing. res.json({ playing: false }); }); // SPA fallback app.get("*", (req, res) => { res.sendFile(path.join(__dirname, "public", "index.html")); }); app.listen(PORT, "0.0.0.0", () => { console.log(`Collage Studio running on port ${PORT}`); });