Skip to content
A minimal example for a REST-API-server written with servant and a test-suite using servant-client
Branch: master
Clone or download
Latest commit 9df20dd Feb 21, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src update to servant-0.13 Feb 22, 2019
.travis.yml add travis file Apr 15, 2016
stack.yaml update to servant-0.15 Feb 22, 2019

This is a very minimal example of a project that uses

  • servant to specify a REST API,
  • servant-server to implement a server,
  • hspec and servant-client for the test-suite.

To set up the project and run the test-suite, do:

stack setup
stack test --fast

To execute the test-suite faster while developing, do:

chmod go-w .ghci .
stack exec ghci test/Spec.hs

and then at the ghci prompt do:


to run the tests and


to reload the code (after making changes) and run the tests again.

To run the app, do:

stack exec example-servant-minimal

Then you can query the server like this:

curl localhost:3000/item
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.