https://github.com/secmohammed/deck-poc
Deck Cards PoC Using Golang
https://github.com/secmohammed/deck-poc
api-testing clean-architecture docker gin golang gorm postgresql viper
Last synced: about 1 month ago
JSON representation
Deck Cards PoC Using Golang
- Host: GitHub
- URL: https://github.com/secmohammed/deck-poc
- Owner: secmohammed
- Created: 2023-03-25T04:44:33.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-25T14:08:11.000Z (about 3 years ago)
- Last Synced: 2025-08-11T13:34:00.596Z (10 months ago)
- Topics: api-testing, clean-architecture, docker, gin, golang, gorm, postgresql, viper
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
To run the application, you have to run
```shell
docker compose up
```
- The application was designed to serve HTTP REST API at PORT 8000, but with consideration to pick the driver you need while exposing port (e.g: we can set gRPC driver and expose it as well)
- The application is going to create the database if it doesn't exist and connect to it automatically. Therefore, there is no any prerequisites to bootstrap the app.
> Create Deck Request
```sh
curl --location -X POST 'localhost:8000/api/decks' \
--header 'Content-Type: application/json' \
--data-raw '{
"shuffle": true
}'
```
### For Deck Card Creation with filtered Cards
```sh
curl --location -X POST 'localhost:8000/api/decks?cards=AS,KD,AC,2C,KH' \
--header 'Content-Type: application/json' \
--data-raw '{
"shuffle": false
}'
```
> Open Deck By ID Request
##### Note: Pass a valid UUID that's retrieved from the previous request
```shell
curl -X GET 'localhost:8000/api/decks/cb3e373f-a51c-421d-ad05-91aff0df890a' \
-H 'Content-Type: application/json'
```
>Draw Card Request
```shell
curl -X PATCH 'localhost:8000/api/decks/cb3e373f-a51c-421d-ad05-91aff0df890a' \
-H 'Content-Type: application/json'
```
### To Draw multiple cards at once
```sh
curl -X PATCH 'localhost:8000/api/decks/cb3e373f-a51c-421d-ad05-91aff0df890a?count=1' \
-H 'Content-Type: application/json'
```
### FOR RUNNING TESTS
After running docker compose up
to start testing deck suite
> ENV=test go test -v ./tests/... -count=1