From 793b35b6da68ffac9562ed774c433b90f22d96c4 Mon Sep 17 00:00:00 2001 From: IM23a-cernik Date: Thu, 17 Apr 2025 13:02:53 +0200 Subject: [PATCH] added ability to create a lobby --- lobby.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lobby.js diff --git a/lobby.js b/lobby.js new file mode 100644 index 0000000..983db7d --- /dev/null +++ b/lobby.js @@ -0,0 +1,20 @@ +const express = require("express"); +const app = express(); +const port = 3000; + +async function createLobby() { + let response = await fetch("https://www.deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1") + let data = await response.json(); + let lobbyId = data.deck_id + console.log(lobbyId); + return lobbyId; +} + +app.get("/lobby/create", async (req, res) => { + let lobbyId = await createLobby(); + res.send("Lobby ID: " + lobbyId); +}) + +app.listen(port, () => { + console.log("Server is running on port " + port); +});