import 'dotenv/config'; import express from 'express'; import cookieParser from 'cookie-parser'; import hostAuth from './routes/hostAuth.js'; import hostPlaylists from './routes/hostPlaylists.js'; import publicPlaylist from './routes/publicPlaylist.js'; import session from './routes/session.js'; const app = express(); app.use(cookieParser()); app.use(express.json()); app.get('/api/health', (req, res) => res.json({ ok: true })); // Spotify's client id is not sensitive (it's public in every authorize // URL, visible in any browser network tab) — served here instead of // baked into the client at build time so the whole app has exactly one // place to configure it (this server's own .env), not a second copy as // a separate CI build-arg/secret. app.get('/api/config', (req, res) => { res.json({ clientId: process.env.SPOTIFY_CLIENT_ID }); }); app.use('/api/spotify', hostAuth); app.use('/api/host', hostPlaylists); app.use('/api/public-playlist', publicPlaylist); app.use('/api/session', session); const PORT = process.env.PORT || 3010; app.listen(PORT, () => { console.log(`fullhouse API listening on :${PORT}`); });