mirror of
https://github.com/Rushilwiz/feud.git
synced 2025-04-17 18:50:19 -04:00
22 lines
469 B
JavaScript
22 lines
469 B
JavaScript
const express = require('express');
|
|
const app = express();
|
|
const http = require('http');
|
|
const server = http.createServer(app);
|
|
const { Server } = require("socket.io");
|
|
const io = new Server(server);
|
|
|
|
app.get('/', (req, res) => {
|
|
res.sendFile(__dirname + '/index.html');
|
|
});
|
|
|
|
io.on('connection', (socket) => {
|
|
socket.on('chat message', (msg) => {
|
|
console.log('message: ' + msg);
|
|
});
|
|
});
|
|
|
|
|
|
server.listen(3000, () => {
|
|
console.log('listening on *:3000');
|
|
});
|