Skip to content

A minimal example for a REST-API-server written with servant and a test-suite using servant-client

Notifications You must be signed in to change notification settings

haskell-servant/example-servant-minimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

:main

to run the tests and

:r
:main

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

About

A minimal example for a REST-API-server written with servant and a test-suite using servant-client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published