Skip to content

Simple example to illustrate how to use persistent and servant in combination.

License

Notifications You must be signed in to change notification settings

bahalperin/example-servant-persistent

 
 

Repository files navigation

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

This version adds serving static files and sending an index.html file when a GET request is made to the root path.

Also, markdown documentation for the API will be sent if a request is made to an invalid route.

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/add --data '{"name": "Alice", "age": 42}'
curl -H 'Content-type: application/json' localhost:3000/user/get/Alice
curl localhost:300
curl localhost:300/static/index.html
curl localhost:300/help

About

Simple example to illustrate how to use persistent and servant in combination.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 98.3%
  • HTML 1.7%