riccardomerolla / distage-example

Example project built using distage, tagless final, http4s, doobie and zio

Home Page:https://github.com/7mind/izumi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

distage example

Example distage project presented at Functional Scala 2019

Features distage, Bifunctor Tagless Final, ZIO Environment for composing test fixtures, and distage-docker for setting up test containers.

To launch tests that require postgres ensure you have a docker daemon running in the background.

Use sbt test to launch the tests.

You can launch the application with the following command.

./launcher -u scene:managed :leaderboard

Afterwards you can call the HTTP methods:

curl -X POST http://localhost:8080/ladder/50753a00-5e2e-4a2f-94b0-e6721b0a3cc4/100
curl -X POST http://localhost:8080/profile/50753a00-5e2e-4a2f-94b0-e6721b0a3cc4 -d '{"name": "Kai", "description": "S C A L A"}'
# check leaderboard
curl -X GET http://localhost:8080/ladder
# user profile now shows the rank in the ladder along with profile data
curl -X GET http://localhost:8080/profile/50753a00-5e2e-4a2f-94b0-e6721b0a3cc4

Note

If ./launcher command fails for you with some cryptic stack trace, there's most likely an issue with your Docker. First of all, check that you have docker and contrainerd daemons running. If you're using something else than Ubuntu, please stick to the relevant installation page:

sudo systemctl status docker
sudo systemctl status contrainerd

Both of them should have Active: active (running) status. If your problem isn't gone yet, most likely you don't have your user in docker group. Here you can find a tutorial on how to do so. Don't forget to logout of your session or restart your virtual machine before proceeding. If you still have problems, don't hesitate to open an issue.

Videos:

About

Example project built using distage, tagless final, http4s, doobie and zio

https://github.com/7mind/izumi

License:Apache License 2.0


Languages

Language:Scala 99.7%Language:Shell 0.3%