Requirements
- Node >= 12
- Yarn >= 1 && < 2
- a MongoDB Instance
Instructions
At ./env/ copy example.env and create your own .env with the same params and named after your env.
Eg: development.env
After you are done with it, add your own JWT Secret and point to a valid MongoDB URL (with password ofc);
$ yarn install && yarn build && yarn start
Copy the API Address and you can already use it via postman, or paste it back on its react counterpart;
Certain routes are protect, in order to access those routes remember to include your JWT Token (acquired via login) to your request headers as follows:
headers.authorization: "Bearer MY_LONG_TOKEN_GOES_HERE"
The base Endpoint for this API is /api/.
The Following endpoints are available using this suffix:
All Auth Endpoints returns a user model with an attached token.
POST auth/login - { username: string, password: string }
POST auth/register - { username: string, password: string }
GET /auth/me
POST deck/ - accepts deckCount on body to create multiple-sized shoe decks;
GET deck/
######Get Deck GET deck/:deckId
DEL deck/:deckId
All Game Endpoints return a fresh GameState object.
POST game/ - { title?: string, deckId: string }
DEL game/:gameId
GET game/
GET game/:gameId
GET game/:gameId/hand/:username
POST game/:gameId/shuffle/
POST game/:gameId/deal
POST game/:gameId/join - accepts { isBot: boolean } to add a Bot player to the room.
POST game/:gameId/leave