You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
422 B
JavaScript
19 lines
422 B
JavaScript
import 'dotenv/config'
|
|
import express from 'express'
|
|
const app = express()
|
|
const port = process.env.PORT || 3000
|
|
|
|
import WeatherScraper from './weatherScraper.js'
|
|
|
|
const scraper = new WeatherScraper()
|
|
await scraper.init()
|
|
setInterval(() => scraper.fetch(), 1000 * 60 * 5)
|
|
|
|
app.get('/', (req, res) => {
|
|
res.json(scraper.data)
|
|
})
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Weather Scraper listening on port ${port}`)
|
|
})
|