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();
app.use(cors({
origin: "*"
origin: "*",
methods: ["GET", "POST"],
allowedHeaders: ["Content-Type"],
credentials: true
}));
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) => {
@ -411,7 +421,7 @@ const getNextPlayer = (players, currentPlayerId) => {
if (players.every(player => player.tombstone)) {
return null;
}
let currentPlayerIdx = players.findIndex(player => player.socketId === currentPlayerId);
let nextPlayerIdx;
do {