listo socket

This commit is contained in:
xXpuma99Xx
2022-01-25 22:08:13 -06:00
parent e8f9a96ecf
commit 833dc127be
12 changed files with 81 additions and 115 deletions
+1 -14
View File
@@ -5,17 +5,8 @@ const cors = require('cors');
const express = require('express');
const app = express();
const { createServer } = require('http');
const { Server } = require('socket.io');
const httpServer = createServer(app);
const io = new Server(httpServer, {
cors: { origin: 'http://localhost:3046' },
// cors: {
// origin: [´
// 'https://pcpuma.acatlan.unam.mx',
// 'https://pcpuma.acatlan.unam.mx:8080',
// ],
// },
});
const io = require('./socket').init(httpServer);
app.use(cors());
@@ -31,10 +22,6 @@ app.get('/', (req, res) => res.send('API Pcpuma'));
app.use(require('./routes/index'));
io.on('connection', (socket) => {
console.log('Conectado');
});
httpServer.listen(Number(process.env.PORT), () =>
console.log(`API Pcpuma corriendo en el puerto: ${process.env.PORT}`.rainbow)
);