Skip to content

Provides API for creating and opening decks as well as drawing cards

Notifications You must be signed in to change notification settings

nlevchuk/decks-and-cards

Repository files navigation

Test

Description

The small application provides API for creating and opening decks as well as drawing cards.

Technical stack

  1. Typescript
  2. NestJS
  3. PostgreSQL

Installation

  1. Clone the project:
$ git clone https://github.com/nlevchuk/decks-and-cards.git
  1. Go to cloned directory and build the application image:
$ make build

Running the application

$ make up

Stopping the application

$ make down

Usage

Create a new deck

## Create full not suffled deck
curl -X "POST" "http://localhost:3000/decks/create" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "type": "FULL",
  "shuffled": false
}'
## Create short not suffled deck
curl -X "POST" "http://localhost:3000/decks/create" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "type": "SHORT",
  "shuffled": false
}'
## Create full suffled deck
curl -X "POST" "http://localhost:3000/decks/create" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "type": "FULL",
  "shuffled": true
}'
## Create short suffled deck
curl -X "POST" "http://localhost:3000/decks/create" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "type": "SHORT",
  "shuffled": true
}'

Open a deck

curl "http://localhost:3000/decks/open?deckId=<DECK ID>"

Draw cards

curl -X "PUT" "http://localhost:3000/decks/draw-cards" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "deckId": "<DECK ID>",
  "count": "3"
}'

Test

$ make test
$ make test-e2e

About

Provides API for creating and opening decks as well as drawing cards

Resources

Stars

Watchers

Forks