Simple example to illustrate how to use persistent and servant in combination.
Switch branches/tags
Nothing to show
Clone or download
harendra-kumar Use stack lts-10.0 (#3)
* Use stack lts-10.0

* Explicit imports for easier understanding

* Fix test code
Latest commit 168b7af Jan 4, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Use stack lts-10.0 (#3) Jan 4, 2018
test Use stack lts-10.0 (#3) Jan 4, 2018
.gitignore switch to file-based sqlite db Jun 7, 2016
.travis.yml add travis file Jun 7, 2016
LICENSE initial Jun 7, 2016 Changed REST routes Oct 9, 2017
Setup.hs initial Jun 7, 2016
example-servant-persistent.cabal Use stack lts-10.0 (#3) Jan 4, 2018
stack.yaml Use stack lts-10.0 (#3) Jan 4, 2018

This project is a small example for how to set up a web-server with servant-server that uses persistent for saving data to a database.

You can build and run the project with stack, e.g.:

stack build
stack exec example-servant-persistent

Then you can query the server from a separate shell:

curl -H 'Content-type: application/json' localhost:3000/user --data '{"name": "Alice", "age": 42}'
curl -H 'Content-type: application/json' localhost:3000/user/Alice