From fc4937535832971eb3ae57e1ad524a7f3173f51d Mon Sep 17 00:00:00 2001 From: SlideBloodForgeCrown Date: Thu, 17 Apr 2025 12:49:18 +0200 Subject: [PATCH 1/3] Delete swagger.json --- swagger.json | 147 --------------------------------------------------- 1 file changed, 147 deletions(-) delete mode 100644 swagger.json diff --git a/swagger.json b/swagger.json deleted file mode 100644 index f07eb11..0000000 --- a/swagger.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "GAMBLE!", - "description": "Gambling API", - "version": "1.0.0" - }, - "servers": [ - { - "url": "http://localhost:3000/" - } - ], - "paths": { - "/register": { - "post": { - "description": "", - "responses": { - "200": { - "description": "OK" - }, - "400": { - "description": "Bad Request" - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "username": { - "example": "any" - } - } - } - } - } - } - } - }, - "/login": { - "post": { - "description": "", - "responses": { - "200": { - "description": "OK" - }, - "400": { - "description": "Bad Request" - }, - "401": { - "description": "Unauthorized" - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "username": { - "example": "any" - } - } - } - } - } - } - } - }, - "/": { - "get": { - "description": "", - "parameters": [ - { - "name": "authorization", - "in": "header", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - } - } - } - }, - "/verify": { - "post": { - "description": "", - "parameters": [ - { - "name": "authorization", - "in": "header", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - } - } - } - }, - "/logout": { - "delete": { - "description": "", - "parameters": [ - { - "name": "authorization", - "in": "header", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK" - }, - "401": { - "description": "Unauthorized" - }, - "403": { - "description": "Forbidden" - } - } - } - } - } -} \ No newline at end of file From e7e225bbe9aee58617c6fd41768a1c01a04df546 Mon Sep 17 00:00:00 2001 From: SlideBloodForgeCrown Date: Thu, 17 Apr 2025 12:49:37 +0200 Subject: [PATCH 2/3] Update data.json --- data.json | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/data.json b/data.json index 366ecfa..41b42e6 100644 --- a/data.json +++ b/data.json @@ -1,20 +1,3 @@ [ - { - "username": "jerome", - "password": "Sigma", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Implcm9tZSIsImlhdCI6MTc0NDg3NDQ2MCwiZXhwIjoxNzQ0ODc2MjYwfQ.4FnQwoi25uSs8VQWBgC3MRvaZfqcoDN8041fky4YDo4", - "money": 200 - }, - { - "username": "Gianimon", - "password": "gianimon", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IkdpYW5pbW9uIiwiaWF0IjoxNzQ0ODc0NTczLCJleHAiOjE3NDQ4NzYzNzN9.dGp5WTKIDVhomKZ8J7nevz8O7PqwRhR9wEgeyDtL_XE", - "money": 200 - }, - { - "username": "any", - "password": "any", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFueSIsImlhdCI6MTc0NDg3OTQ1NCwiZXhwIjoxNzQ0ODgxMjU0fQ.xTV0yfMBO0BTsmggjouwYrx180un9rHiDljQqN6IUdw", - "money": 200 - } -] \ No newline at end of file + +] From 793b35b6da68ffac9562ed774c433b90f22d96c4 Mon Sep 17 00:00:00 2001 From: IM23a-cernik Date: Thu, 17 Apr 2025 13:02:53 +0200 Subject: [PATCH 3/3] 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); +});