Logo

Deck Of Cards API

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Testing

About The Project

An API to create a deck of cards, open a deck of cards, draw one or multiple cards.

Getting Started

Prerequisites

Before this project can be run locally you will need to install Go

Installation

To utilize the project, the following needs to be done:

  1. Clone this repository
  2. Install the dependencies, using the following command:
go mod tidy

Usage

  1. To run the project locally, use the following command:
go run main.go
  1. To create a deck of cards, use Postman to make a GET request to the following URL:
http://localhost:3000/api/create
  1. To open a deck of cards, use Postman to make a GET request to the following URL:
http://localhost:3000/api/open/{deck_id}
  1. To draw a card or multiple cards, use Postman to make a GET request to the following URL:
http://localhost:3000/api/draw/{deck_id}?count={any number}

Testing

Tests can be run using the following command:

go test ./...