Skip to content

alexkonovalov/cards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

alexkonovalovalexander konovalov
and
alexander konovalov
Oct 5, 2022
d84a176 · Oct 5, 2022

History

9 Commits
Oct 5, 2022
Oct 5, 2022
Oct 5, 2022
Oct 5, 2022
Oct 5, 2022
Aug 22, 2022
Aug 22, 2022
Aug 22, 2022
Oct 5, 2022
Oct 5, 2022
Aug 22, 2022
Aug 22, 2022
Oct 5, 2022
Aug 22, 2022
Aug 25, 2022
Oct 5, 2022

Repository files navigation

Description

Card Deck basic API

Methods Supported

1. Create a deck of cards

POST /deck/create

Examples:

stretched & shuffled deck:

$ curl --location --request POST 'localhost:3333/deck/create' \
--header 'Content-Type: application/json' \
--data-raw '{ "type": "SHORT", "shuffled": true }
'

full & unshuffled deck:

$ curl --location --request POST 'localhost:3333/deck/create' \
--header 'Content-Type: application/json' \
--data-raw '{ "type": "FULL", "shuffled": false }
'

2. Open a deck

GET  /deck/open

Examples:

Open deck with deckId 00112233-4455-6677-8899-aabbccddeeff

$ curl --location --request GET 'localhost:3333/deck/open/00112233-4455-6677-8899-aabbccddeeff'

3. Draw from a deck

PUT  /deck/draw

Examples:

Draw 7 cards from deck with deckId 00112233-4455-6677-8899-aabbccddeeff

$ curl --location --request PUT 'localhost:3333/deck/draw/00112233-4455-6677-8899-aabbccddeeff' \
--header 'Content-Type: application/json' \
--data-raw '{
    "count": 7
}'

Installation & Prepare environment

NB! Docker, yarn & npm should be already installed on your machine

First of all

$ yarn install

To run service DEV mode:

$ yarn run db:dev:up
$ yarn run db:dev:migrate
$ yarn run start

To test service:

$ yarn run test

To test e2e:

$ yarn run test:e2e

To see test coverage:

$ yarn run test:cov

To stop DB containers:

$ yarn db:test:rm
$ yarn db:dev:rm

Creator

Alexander Konovalov

Built with NestJS

Nest Logo