init commit. working to connect express server to react with socket io

This commit is contained in:
2022-06-04 12:19:36 -05:00
commit 14e4b53d54
16 changed files with 4009 additions and 0 deletions

29
index.js Normal file
View File

@@ -0,0 +1,29 @@
const express = require('express');
const app = express();
const cors = require('cors');
app.use(cors());
const http = require('http');
const server = http.createServer(app);
const socketIO = require('socket.io');
const io = socketIO(server, {
cors: {
origin: 'http://localhost:3000'
}
});
io.on('connection', (socket) => {
console.log('client connected: ' + socket.id);
});
app.use('/', (req, res) => {
})
app.listen(8000, (err) => {
if (err) console.log(err);
console.log("Listening on 8000");
})