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-webserver
The server will start on http://localhost:5000
.
To run the command-line interface (CLI) version:
make run-cli
To run the tests:
make test
To build the binaries:
make build
This 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 Found
if the player does not exist.
-
POST /players/{name}
- Records a win for a specific player.
- Example:
POST /players/Pepper
- Returns a
202 Accepted
on success.