This is a REST api implementation of a scoring application for a standard ten-pin bowling game. It supports:
- Generating a new scorecard for a game
- Scoring a Frame of the game
- Calculating the score of a given scorecard
The application uses stack to build, run tests and run. You could also use this Dockerfile to build the application if you do not have stack available.
Once you have stack installed:
- tests - You can run the tests by executing
stack test
. - application - You can run the application by executing
stack run
- the application will run on port 3000
POST /scorecards
will return you a new scorecardPOST /scorecards/calculate
will calculate the score of the scorecard. If the game is complete it will give you the final score of the game as well
I have included some fixture json files for you to manually test the server with {nonscoringgame,perfectGame,unplayedGame}.json. Assuming the server is running, you can use these as follows:
curl -XPOST --data "@filename.json" localhost:3000/scorecards/calculate