22 lines
554 B
JavaScript
22 lines
554 B
JavaScript
import express from 'express';
|
|
import { getStops, setStops } from './src/config.mjs';
|
|
import { departuresRouter } from './src/departures-router.mjs';
|
|
import { startScraper } from './src/runner.mjs';
|
|
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
if (getStops().length === 0) {
|
|
console.error('No stops configured. Please configure stops in config.json. Defaulting to [7].');
|
|
|
|
setStops([7]);
|
|
}
|
|
|
|
startScraper();
|
|
const app = express();
|
|
|
|
app.use(departuresRouter);
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`🚀 Server running at http://localhost:${PORT}`);
|
|
});
|