Skip to content
/ deckr Public

Deckr provides a REST/gRPC API to simulate a deck of cards.

License

Notifications You must be signed in to change notification settings

mgjules/deckr

Repository files navigation

deckr 🃏

Go Doc Conventional Commits License

Deckr provides a REST/gRPC API to simulate a deck of cards.

Contents

Requirements

  • Go 1.18+

  • Mage - replacement for Makefile in Go.

    $ go install github.com/magefile/mage@latest
  • Golangci-lint - Fast Go linters runner.

    $ go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  • Ginkgo - Expressive testing framework.

    $ go install github.com/onsi/ginkgo/v2/ginkgo@latest
  • Buf - A new way of working with Protocol Buffers.

    $ go install github.com/bufbuild/buf/cmd/buf@latest
  • Protoc - Protocol Buffers compiler.

    For installation instructions, see Protocol Buffer Compiler Installation.

  • Protoc-gen-go - Go code generator for Protocol Buffers.

    $ go install github.com/golang/protobuf/protoc-gen-go@latest
  • Protoc-gen-go-grpc - Go code generator for gRPC.

    $ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
  • Docker - Containerization.

Mage Targets

$ mage -l
Targets:
  build:all           Builds for all supported popular OS/Arch
  build:linuxAmd64    Builds for Linux 64bit
  build:linuxArm64    Builds for Linux ARM 64bit
  build:macOSAmd64    Builds for MacOS 64bit
  build:macOSArm64    Builds for MacOS M1
  build:winAmd64      Builds for Windows 64bit
  lint                Run golangci linters
  proto               Generate stubs from proto files
  test                Run tests
  testRace            Run tests with race detector
  tidy                Run go mod tidy

Example

Generate stubs from proto files

$ mage -v proto

Run tests with race detector

$ mage -v testRace

Build deckr for MacOS M1

$ mage -v build:macOSArm64

Install

  • You can install using the latest released binary.

  • OR using Go:

    $ go install github.com/mgjules/deckr@latest
  • OR bulding from source:

    Example (MacOS M1):

    $ mage -v build:macOSArm64

Usage

$ deckr --help
NAME:
   deckr - A REST/gRPC API for playing with a deck of cards

USAGE:
   deckr [global options] command [command options] [arguments...]

DESCRIPTION:
   Deckr exposes a REST/gRPC API for playing with a deck of cards of your choice.

AUTHOR:
   Michaël Giovanni Jules <[email protected]>

COMMANDS:
   serve       Starts the REST/gRPC API server.
   version, v  Shows the version
   help, h     Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help (default: false)

COPYRIGHT:
   (c) 2022 Michaël Giovanni Jules

REST/gRPC API server

$ deckr serve --help
NAME:
   deckr serve - Starts the REST/gRPC API server.

USAGE:
   deckr serve [command options] [arguments...]

OPTIONS:
   --debug              whether running in PROD or DEBUG mode (default: false) [$DECKR_DEBUG]
   --server-host value  HOST of server (default: "localhost") [$DECKR_SERVER_HOST]
   --server-port value  PORT of server (default: 9000) [$DECKR_SERVER_PORT]
   --storage-uri value  URI of storage (default: "inmemory://") [$DECKR_STORAGE_URI]
   --help, -h           show help (default: false)

REST API documentation

The REST API documentation is generated using Swag and is available at /swagger/index.html.

License

Deckr is Apache 2.0 licensed.