This is a coding challenge project given by Toggl.com hiring team.
The data is stored in memory and not persisted into a DB or FS.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- First clone the repository to your local machine.
- Execute the following command to run api server locally:
make run
test create new default deck endpoint
curl -X POST http://localhost:8080/api/deck
test create new full shuffled deck endpoint
curl -X POST -G 'http://localhost:8080/api/deck' -d 'shuffle=true'
test create new deck with custom cards endpoint
curl -X POST -G 'http://localhost:8080/api/deck' -d 'cards=2C,3D,10H,KC'
test open existing deck endpoint (replace <deck_id> with actual deck id)
curl -X GET http://localhost:8080/api/deck/<deck_id>
test draw card from deck endpoint (replace <deck_id> with actual deck id and count number)
curl -X PUT http://localhost:8080/api/deck -d '{"deck_id": "<deck_id>", "count": 2}'
build the application
make build
run the application
make run
run the test suite
make test
run test coverage
make test-cover
clean up binary from the last build
make clean