index.ts
440 Bytes
import express from "express";
import socketIo from "socket.io";
import { createServer } from "http";
import { SocketHandler } from "./SocketHandler";
const PORT = 3000;
const app = express();
const server = createServer(app);
const io = new socketIo.Server(server);
const handler = new SocketHandler();
io.on("connection", (socket) => {
handler.connected(socket);
});
server.listen(PORT, () => console.log(`Listening on ${PORT}`));