]> git.cworth.org Git - zombocom-ai/blob - index.js
27b37147c1796569df0e625d8b88db2998e7175a
[zombocom-ai] / index.js
1 const express = require('express');
2 const app = express();
3 const http = require('http');
4 const server = http.createServer(app);
5 const { Server } = require("socket.io");
6 const io = new Server(server);
7 const port = 2122;
8
9 app.get('/index.html', (req, res) => {
10     res.sendFile(__dirname + '/index.html');
11 });
12
13 io.on('connection', (socket) => {
14     socket.on('comment', (msg) => {
15         io.emit('comment', msg);
16     });
17 });
18
19 server.listen(port, () => {
20     console.log(`listening on *:${port}`);
21 });