Created
September 17, 2019 11:16
-
-
Save dennbagas/6270c61491157fab6fdcdb5885701126 to your computer and use it in GitHub Desktop.
Updated server.js API weather
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const cors = require('cors'); | |
const weather = require("./weather"); | |
const app = express(); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: false })); | |
app.use(cors()); | |
app.get('/', function (req, res) { | |
res.send('Hello World!'); | |
}); | |
app.listen(4000, function () { | |
console.log('Example app listening on port 4000!'); | |
// Update | |
resource.get() | |
.then(() => { | |
const oneDayInMs = 86400000; | |
setInterval(() => weather.get(), oneDayInMs); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment