Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Another Haskell excercise for trainings

branch: fulari

This branch is 0 commits ahead and 1 commit behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 beercounter.cabal
Octocat-spinner-32 repl
Octocat-spinner-32 start-mongo.sh
Octocat-spinner-32 stop-mongo.sh
README.md

Installation

  • Install MongoDB. On Mac: brew install mongo
  • Create database directory: mkdir db
  • Build and install: cabal install
  • Now you have an executable beercounter

Running

Start the mongoDB server:

start-mongo.sh

Start beercounter:

beercounter

Running in GHCI

Start GHCI with beercounter source directories:

./repl

Load Server.hs and start it:

:l Server
main

Server is now running. Use Ctrl-C to stop it and :q to exit GHCI.

Building the executable

Build with cabal:

cabal install

Testing

Buy a round:

curl -d '{"buyer":"juha", "others":["juho", "atte"]}' localhost:8000/buyRound

Check karma:

curl localhost:8000/karma/juho/atte
Something went wrong with that request. Please try again.