This is a very minimal example of a project that uses
servantto specify a REST API,servant-serverto implement a server,hspecandservant-clientfor the test-suite.
To set up the project and run the test-suite, do:
stack setup
stack test --fastTo execute the test-suite faster while developing, do:
chmod go-w .ghci .
stack exec ghci test/Spec.hsand then at the ghci prompt do:
:mainto run the tests and
:r
:mainto reload the code (after making changes) and run the tests again.
To run the app, do:
stack exec example-servant-minimalThen you can query the server like this:
curl localhost:3000/item