forked from Brojowski/intheloopbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (24 loc) · 915 Bytes
/
Copy pathindex.js
File metadata and controls
33 lines (24 loc) · 915 Bytes
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
var express = require('express');
var app = express();
var server = require('http').Server(app);
var portal = require('./portal');
var io = require('socket.io')(server);
var snoowrap = require('snoowrap');
const config = require('./config/config.js').config;
const projectRoot = __dirname;
module.exports.projectRoot = projectRoot;
const reddit = new snoowrap(config);
app.use(express.static('public'));
app.get('/', (req, res) => {
res.sendFile('./public/index.html', { root: projectRoot });
});
app.get('/socket.io/socket.io.js', (req, res) => {
res.sendFile('./node_modules/socket.io-client/dist/socket.io.js', { root: projectRoot });
});
app.get('/chart-js/chart.js', (req, res) => {
res.sendFile('./node_modules/chart.js/dist/Chart.js', { root : projectRoot });
});
io.on('connection', (socket) => {
portal(socket, reddit);
});
server.listen(8080, () => console.log('Server started'));