Cors config
All checks were successful
gitea/minesweeper-backend/pipeline/head This commit looks good

This commit is contained in:
Jose134 2025-01-22 14:50:38 +01:00
parent 3b7894f644
commit 316a4ebe8d

View File

@ -11,10 +11,20 @@ const { randomUUID } = require('crypto');
const app = express(); const app = express();
app.use(cors({ app.use(cors({
origin: "*" origin: "*",
methods: ["GET", "POST"],
allowedHeaders: ["Content-Type"],
credentials: true
})); }));
const server = createServer(app); const server = createServer(app);
const io = new Server(server); const io = new Server(server, {
cors: {
origin: "*",
methods: ["GET", "POST"],
allowedHeaders: ["Content-Type"],
credentials: true
}
});
io.on('connection', (socket) => { io.on('connection', (socket) => {
@ -411,7 +421,7 @@ const getNextPlayer = (players, currentPlayerId) => {
if (players.every(player => player.tombstone)) { if (players.every(player => player.tombstone)) {
return null; return null;
} }
let currentPlayerIdx = players.findIndex(player => player.socketId === currentPlayerId); let currentPlayerIdx = players.findIndex(player => player.socketId === currentPlayerId);
let nextPlayerIdx; let nextPlayerIdx;
do { do {