diff --git a/gambling.js b/gambling.js index 15eb412..a240882 100644 --- a/gambling.js +++ b/gambling.js @@ -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) => { let lobbyId = req.query.lobbyId; let players = playerMap[lobbyId] || []; diff --git a/swagger.js b/swagger.js index 89d0c84..13114d8 100644 --- a/swagger.js +++ b/swagger.js @@ -5,7 +5,7 @@ const doc = { title: 'GAMBLE!', description: 'Gambling API' }, - host: 'localhost:3000', + host: 'localhost:25565', components: { securitySchemes:{ bearerAuth: {