-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
34 lines (33 loc) · 1010 Bytes
/
app.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
require('dotenv').config();
const path = require('path');
const express = require('express');
const compression = require('compression');
const passport = require('passport');
const app = express();
const server = require('http').Server(app);
const io = require('socket.io')(server);
app.set('view engine', 'pug');
app.set('views', path.join(__dirname, 'views'));
app.use(passport.initialize());
app.use((req, res, next) => {
res.io = io;
next();
});
app.use(compression());
require('./startup/notification');
require('./startup/passport-setup');
require('./startup/logging')(app);
require('./startup/ratelimit')(app);
require('./startup/routes')(app);
require('./startup/sanitization')(app);
require('./startup/db')();
io.on('connection', socket => {
__logger.info(`number of sockets open: ${io.engine.clientsCount}`);
socket.on('connect', () => {
__logger.info('Connection');
});
socket.on('disconnect', data => {
__logger.info('disconnect');
});
});
module.exports = { app, server };