/poker101-api

Application Programming Interface for the SWE681 secure application project @ GMU

Primary LanguageTypeScript

Poker101 API Documentation

Game Description

Poker101 allows users to play 5 Draw Poker

  • Users can create a profile by signing up
  • Sign in once the profile is created
  • Create games and invite players
  • Join existing game
  • 2 rounds
  • Player who creates game is dealer
  • First player who joins the game who is not the dealer is Player 2 and has the first move each round
  • Discard allowed after first round finishes
  • If players have equally ranked hands, pot is split
  • Ace can be used for highest or lowest card in a straight
  • If all players check in the first round of betting, the deal moves to the next player and another ante is added by each player
  • If a player leaves, there must be a timeout where eventually they will forfeit

Technologies

typescript node express mongodb mongoose npm jest

API can be reached at

swe681game-api.net

To run the server locally

Run npm run start in root directory. The server will use http://localhost:8000/.

API Methods

Game - /api/game

  • create()
  • get()
  • getAll()
  • check()
  • bet()
  • call()
  • raise()
  • discard()
  • fold()
  • complete()

User - /api/user

  • createUser()
  • getUser()
  • getUsers()
Endpoint Method Description
/api/user/user POST Creates a new user
/api/user/user GET Returns an existing user
/api/user/users GET Returns an array of existing users
/api/game/game POST Creates a new game
/api/game/game GET Returns an existing game
/api/game/games GET Returns an array of existing games
/api/game/check POST Player defers betting option. If at a later point a player bet, any player that has checked must then call, raise or fold
/api/game/bet POST Player can add an amount to a pot
/api/game/call POST Player adds the amount to the pot that the player before them bet. This is one of two possible responses to a bet
/api/game/raise POST Player adds the amount to the pot that the player before them bet plus an additional amount. This is one of two possible responses to a bet
/api/game/discard POST Player can discard no more than 3 cards after first round of betting
/api/game/fold POST Player exists the game
/api/game/complete POST Records the outcome and statistics of the game

Entity Diagram

SWE681-DB