swagger port updated and added leave button

This commit is contained in:
2025-05-06 15:26:48 +02:00
parent b3040ad092
commit 68cb790fdf
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -252,6 +252,18 @@ app.get("/lobby/join", authenticateToken, async (req, res) => {
} }
}); });
app.delete("/lobby/leave", authenticateToken, async (req, res) => {
let lobbyId = req.query.lobbyId;
let username = req.query.username;
console.log(playerMap);
if (lobbyId in playerMap) {
playerMap[lobbyId].splice(username, 1);
res.send("Succesfully logged out.");
} else console.log("Couldn't leave");
});
app.get("/lobby/players", authenticateToken, async (req, res) => { app.get("/lobby/players", authenticateToken, async (req, res) => {
let lobbyId = req.query.lobbyId; let lobbyId = req.query.lobbyId;
let players = playerMap[lobbyId] || []; let players = playerMap[lobbyId] || [];
+1 -1
View File
@@ -5,7 +5,7 @@ const doc = {
title: 'GAMBLE!', title: 'GAMBLE!',
description: 'Gambling API' description: 'Gambling API'
}, },
host: 'localhost:3000', host: 'localhost:25565',
components: { components: {
securitySchemes:{ securitySchemes:{
bearerAuth: { bearerAuth: {