Created
June 26, 2021 22:11
-
-
Save mices/9efb99ab7d35513fbc8210d26ee48c7c to your computer and use it in GitHub Desktop.
Snippet from top of server.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config(); | |
const express = require("express"); | |
const http = require("http"); | |
const app = express(); | |
const cors = require('cors'); | |
const server = http.createServer(app); | |
const socket = require("socket.io"); | |
const io = socket(server); | |
io.use(cors()); | |
const users = {}; | |
const socketToRoom = {}; | |
io.on('connection', socket => { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment