A Servant and Beam codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with Servant and Beam including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Haskell community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
With the caveat that the Authorization header format is slightly different, this is done:
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 31 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 46 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 17 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 280 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 18s │
├───────────────────────────────────────────────┤
│ total data received: 5.77KB (approx) │
├───────────────────────────────────────────────┤
│ average response time: 25ms │
└───────────────────────────────────────────────┘
- I'm not thrilled by that average response time, this is over localhost ... working with quite empty tables.
- Use Nix to get all the Haskell package and application dependencies you need.
$ nix-shell
- Create .envrc from example and allow contents
$ cp .envrc.example .envrc
$ direnv allow
- Setup the database.
$ database/scripts/setup
- Run the test suite.
$ cabal new-test
You can run these in a watch mode using ghcid:
$ dev/watch-tests
Which might look something like this:
- Run the app.
$ cabal new-run exe:realworld-conduit