added ability to create a lobby

This commit is contained in:
IM23a-cernik
2025-04-17 13:02:53 +02:00
parent b8e53c1eb0
commit 793b35b6da
+20
View File
@@ -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);
});