A solid starting point for haskell APIs
Opinionated Yesod stack for APIs serving frontend applications.
If you don't have stack, install it
curl -sSL https://get.haskellstack.org/ | sh
hi to provide the bootstrapping
- stack install --resolver=lts-7.18 hi
- if it fails
git clone email@example.com:trofi/hi && cd hi && stack install && cd ..
- hi myProject --repository gh:tippenein/slab
- cd myProject
- make db_user
What you get
A running yesod api with seeds, tests, CI (circle.yml), google oauth, a dumb-simple role system, among other things.
There are a variety of convenience commands in the Makefile:
make db - creates the database if it doesn't exist already make db_down - drops the database make db_test - creates the test database make db_user - creates the postgres user for the db (should only be needed initially) make db_reset - drop, create, and seed make seed - run seeds (config/Seed.hs)
To build and push a docker container to dockerhub, use
make publish. From there it's up to you :D
Using this to serve a frontend
There is a
templates directory with
default-layout-wrapper.hamlet which you can serve your initial frontend with (probably linking in something from
static/js/bundle.js ). The
default-layout.hamlet is just included if you want to separate the wrapper and actual rendered html further. You can read more about those in yesod documentation.