Framework API to handle the deck and cards, built in Go with Gin HttpServer
Contributors: PathToLife
- Fair Card shuffling using crypto/rand + Fisher-Yates shuffle algorithm [oldwestaction]
Edit/Create .env file in the project root if needed, an example is below
PORT=3000
DEBUG=true
To Run Server (defaults to port 3000, will also download dependencies and build)
go run .
To Run all tests
go test ./tests
To Build
go build
Alternatively Postman Collection: docs/DecksFramework.postman_collection.json
QueryParams
shuffle=<true | false>
shuffles the deckcards=AS,2S
comma separated list of cards
Example Return
{
"deck_id": "5f2ffb68-ce1c-430a-9141-81caa9b3204c",
"shuffled": false,
"remaining": 52
}
QueryParams
uuid
deck_id from POST/deck/create
Example Return
{
"deck_id": "5f2ffb68-ce1c-430a-9141-81caa9b3204c",
"shuffled": false,
"remaining": 52,
"cards": [
{
"value": "ACE",
"suit": "SPADES",
"code": "AS"
},
"..."
]
}
QueryParams
uuid
deck_id from POST/deck/create
count
number of cards to draw
Example Return
{
"cards": [
{
"value": "ACE",
"suit": "SPADES",
"code": "AS"
},
{
"value": "2",
"suit": "SPADES",
"code": "2S"
}
]
}