forked from NativeYogurt/ApplyMate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
54 lines (48 loc) · 1.92 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const env = require('dotenv').config();
const express = require('express');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpack = require('webpack');
const bodyParser = require('body-parser');
const webpackConfig = require('./webpack.config.js');
const path = require('path');
const CronJob = require('cron').CronJob;
const db = require('./backend/db/db');
const emailer = require('./backend/utilities/emailer');
const websiteChecker = require('./backend/utilities/websiteChecker');
const router = require('./backend/router/routes.js');
const compression = require('compression');
const User = require('./backend/models/User');
const SavedJobs = require('./backend/models/SavedJobs');
const Contacts = require('./backend/models/Contacts');
const Events = require('./backend/models/Events');
const Tasks = require('./backend/models/Tasks');
const Github = require('./backend/utilities/githubRepoCrawler');
const Emailer = require('./backend/utilities/emailer');
const Texter = require('./backend/utilities/twilio');
const app = express();
app.use(compression());
const compiler = webpack(webpackConfig);
app.use(bodyParser.json({ limit: '50mb' }));
app.use(express.static(path.join(__dirname, '/public')));
app.use('/api', router);
app.use(webpackDevMiddleware(compiler, {
hot: true,
filename: 'bundle.js',
publicPath: '/',
stats: {
colors: true,
},
historyApiFallback: true,
}));
const server = app.listen(process.env.PORT || 3000, () => {
const host = server.address().address;
const port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
new CronJob('30 03 * * *', function() {
console.log('You will see this message every day at 4:30pm et');
Github.cronGitHubUpdate();
Emailer.sendInterviewReminder();
// websiteChecker.checkActivePosts(); had to comment out, active posts uses nightmare
Texter.sendTextReminder();
}, null, true, 'America/New_York');