Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 1.96 KB

README.md

File metadata and controls

84 lines (61 loc) · 1.96 KB

Build Status

Hanabi Backend

This is a Backend for playing Hanabi written in Haskell.

Setup

Local MongoDB

You need a local mongoDB instance. Docker (install MacOS: https://docs.docker.com/docker-for-mac/install/) can help to keep your environment clean:

To pull the MongoDB Container, run:

docker pull mongo:4.0.4

To run it:

docker run -d -p 27017-27019:27017-27019 mongo:4.0.4

In case you are using vsc, there is a fancy docker extension which allows you to restart and manage your containers (https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)

Otherwise you can restart/start your container by:

docker restart $(docker ps -a | grep mongo:4.0.4 | cut -d ' ' -f 1)

(A nice graphical client for MongoDB is Robo3T)

Project Setup

As global dependency's you need: make (should be preinstalled), ghcid and stack (should be preinstalled).

For ghcid, run:

cd ~ && stack install ghcid # Note you will be in ~after execution

To launch the project, you can simply run:

make run

To run the unit tests, you can run:

make ptest

To acesss a project wide ghci, you can run:

make ghci

Documentation

For creating documentation apidoc.js is used (https://apidocjs.com/).

Install it in case you want to create documentation.

To create documentation, use make doc

ENVIROMENT

The backend needs to be configured, by a .env file before running create a file .env. An example for a configuration using your local environment is:

export DB_ADDR="localhost"
export DB_NAME="tests"
export DB_USE_REPLICA="false"
export DB_USER=""
export DB_PW=""
export PORT="8080"
export JWT_SECRET="psssst!"
"

Hints

Since we are using ghcid in this project, you can test code inline, by adding the following comment:

-- $> <code to execute>