]> git.cworth.org Git - zombocom-ai/blob - index.js
3ffea3d9feef95ac81ac8a66c2b5c68badc018e9
[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     console.log('a user connected');
15     socket.on('comment', (comment) => {
16         console.log('comment: ' + comment);
17     });
18 });
19
20 server.listen(port, () => {
21     console.log(`listening on *:${port}`);
22 });