You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
418 B
20 lines
418 B
const express = require('express'); |
|
const app = express(); |
|
|
|
const server = app.listen(3000, function () { |
|
console.log('Example app listening on port 3000!'); |
|
}) |
|
|
|
const io = require('socket.io').listen(server); |
|
|
|
const update = data => { |
|
console.log('recieved ' + data); |
|
} |
|
|
|
app.use('/', express.static('dist')) |
|
|
|
io.on('connection', socket => { |
|
socket.on('update', data => { |
|
update(data); |
|
}); |
|
});
|
|
|