You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
402 B
JavaScript
18 lines
402 B
JavaScript
const express = require('express');
|
|
const app = express();
|
|
const http = require('http').Server(app);
|
|
const port = process.env.PORT || 3000;
|
|
|
|
const io = require('socket.io')(http);
|
|
|
|
app.use(express.static(__dirname + '/public'));
|
|
|
|
io.on('connection', onConnection);
|
|
|
|
http.listen(port, () => console.log('listening on port ' + port));
|
|
|
|
function onConnection(socket){
|
|
console.log('a user connected');
|
|
}
|
|
|