-
Notifications
You must be signed in to change notification settings - Fork 0
/
botV2.js
34 lines (29 loc) · 948 Bytes
/
botV2.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
const express = require('express');
const bodyParser = require('body-parser');
const morgan = require('morgan');
const app = express();
const port = 8080;
const logger = require('./utils/logger').logger;
const db = require('./utils/db');
const config = require('./config');
const routes = require('./routes');
const twitter = require('./twitter');
app.use(bodyParser.json());
app.use(morgan('dev'));
app.use('/bot', routes);
app.use(express.static(__dirname + '/view/bot-dashboard/build'));
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/view/bot-dashboard/build/index.html'));
});
logger.info("Starting twitter bot...");
app.listen(port, () => {
logger.info(`Bot app listening on port ${port} !`);
db.connect(config.dbUrl, config.dbName, (err) => {
if (err) {
logger.error("Problem to connect to mongodb.");
process.exit(1);
}
//twitter.startConcoursStream();
//twitter.startConcours();
});
});