-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
24 lines (20 loc) · 695 Bytes
/
server.js
File metadata and controls
24 lines (20 loc) · 695 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
'use strict';
const express = require('express');
const { Server } = require('http');
const socketio = require('socket.io');
const app = express();
const server = Server(app);
const managerIO = socketio(server);
require('dotenv').config();
const PORT = process.env.PORT || 3000;
const socketEventHandlers = require('./manager/socketEventHandlers.js');
// This route is to keep the heroku dyno from idling during usage
app.get('/ping-dyno', (req, res) => {
console.log('Dyno pinged!');
res.end();
});
// // Server is Listening
server.listen(PORT, () => console.log(`Listening on port ${PORT}`));
managerIO.on('connection', (socket) => {
socketEventHandlers(socket, managerIO);
});