1var app = require('express')();
2var http = require('http').createServer(app);
3var io = require('socket.io')(http);
4
5app.get('/', (req, res) => {
6 // Ran when a GET request to path '/'
7 res.sendFile(__dirname + '/index.html');
8});
9
10io.on('connection', (socket) => {
11 // Ran when a socket connected
12});
13
14http.listen(3000, () => {
15 // Ran when server is ready to take requestes
16});