This is a Backend for playing Hanabi written in Haskell.
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)
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
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
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!"
"
Since we are using ghcid in this project, you can test code inline, by adding the following comment:
-- $> <code to execute>