-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (27 loc) · 910 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const express = require('express');
const app = express();
const path = require('path');
const cors = require('cors');
const cronJob = require('./scripts/cron');
const pullAirports = require('./scripts/airports');
app.use(cors())
//use this instead of bodyparser setup
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use("/", express.static(path.join(__dirname + '/client/build')));
app.use('/api', require('./routes/api'));
// catch-all
// app.get('*', (req, res) => {
// res.sendFile(path.join(__dirname + '/client/build/index.html'));
// });
// scripts to get ready for data pulls, uncomment as needed
// pullAirports.pull();
// yelpPars.download();
// yelpPars.parse();
// refresh data in S3 bucket
cronJob.yelpcron();
cronJob.weathercron();
cronJob.flightcron();
app.listen(process.env.PORT || 5000, function() {
console.log('Successfully connected...');
});