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 + +] 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); +}); 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