Skip to content

Instantly share code, notes, and snippets.

@mices
Created June 26, 2021 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mices/9efb99ab7d35513fbc8210d26ee48c7c to your computer and use it in GitHub Desktop.
Save mices/9efb99ab7d35513fbc8210d26ee48c7c to your computer and use it in GitHub Desktop.
Snippet from top of server.js
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