A basic HTTP server written in Go for playing poker.
- Go (version 1.23 or newer)
- Make
This project includes a Makefile to simplify common tasks.
To run the web server:
make run-webserverThe server will start on http://localhost:5000.
To run the command-line interface (CLI) version:
make run-cliTo run the tests:
make testTo build the binaries:
make buildThis will create cli and webserver executables in the build/ directory.
The HTTP server provides a set of endpoints to manage player scores and play a game of poker.
-
GET /league- Returns a JSON array of all players, sorted by their number of wins in descending order.
-
GET /players/{name}- Retrieves the score for a specific player.
- Example:
GET /players/Pepper - Returns the player's score as a plain text response.
- Returns a
404 Not Foundif the player does not exist.
-
POST /players/{name}- Records a win for a specific player.
- Example:
POST /players/Pepper - Returns a
202 Acceptedon success.