import express from 'express' import { fileURLToPath } from 'url' import { dirname, join } from 'path' import scraperRoute from './routes/scraper.js' const __dirname = dirname(fileURLToPath(import.meta.url)) const app = express() const PORT = process.env.PORT || 3000 app.set('view engine', 'ejs') app.set('views', join(__dirname, 'views')) app.use(express.json()) // ─── routes ────────────────────────────────────────────────────────────────── app.get('/', (_, res) => res.render('scraper')) app.use('/api/scraper', scraperRoute) // ─── start ─────────────────────────────────────────────────────────────────── app.listen(PORT, () => { console.log(`SCRPR running → http://localhost:${PORT}`) })