Skip to content

Instantly share code, notes, and snippets.

@dennbagas
Created September 17, 2019 11:16
Show Gist options
  • Save dennbagas/6270c61491157fab6fdcdb5885701126 to your computer and use it in GitHub Desktop.
Save dennbagas/6270c61491157fab6fdcdb5885701126 to your computer and use it in GitHub Desktop.
Updated server.js API weather
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