Cors config
All checks were successful
gitea/minesweeper-backend/pipeline/head This commit looks good
All checks were successful
gitea/minesweeper-backend/pipeline/head This commit looks good
This commit is contained in:
parent
3b7894f644
commit
316a4ebe8d
16
index.js
16
index.js
@ -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 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user