A minimal example of constructing a JSON api in haskell using servant and
postgresql-typed. The api serves a single endpoint at /users
.
Database migrations are configured using sqitch.
Example test makes use of pg_tmp to spin up a temp db for test.
Initial setup is a little manual at this point. The following need to be installed prior to dev work:
- Haskell stack
- Running postgresql instance
- Environment variable
DB_URI
set to database URI - Environment variables set for postgresql-typed as described here
- sqitch
Assuming that postgres is running at default port the following command will migrate db:
sqitch deploy
stack run
- to run server
stack build
- to compile server
stack test
- run tests