don41382 / zio-http4s-doobie-auth-example

A zio, http4s, doobie, basic-auth example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zio-http4s-doobie-auth-example

Welcome to my ZIO playground. After I visited a scala meetup where Wiem presented the ZIO framework, I knew I had to dig into this.

I included my favourite frameworks:

  • http4s
  • circe
  • doobie
  • postgres
  • pureconfig

What can I do with this?

It's a really simple app and just has to http access point:

  1. Show alle existing users in a database via the Root route
  2. Allow existing users too authenticate via the /secure route

How to run it?

As always, check out the git repo:

git clone git@github.com:don41382/zio-http4s-doobie-auth-example.git

Compose the docker instance, to have access to a postgres instance on port 54320

docker-compose up -d

And in the end, run sbt with the sbt-resolver plugin command

sbt "~reStart"

Done! Now you can play around. Change things and make your own picture of the awesomeness of zio.

Login to the secure area

  1. Username: "Felix", password: "password"
  2. Username: "Klaus", password: "123456"

Issue

This project also helped me to understand, how to catch defect in http4s.

For more details, checkout the issue on this.

Thanks

Just a quick thanks for the support to Wiem and Kai for helping me to understand the error handling in ZIO/http4s.

About

A zio, http4s, doobie, basic-auth example


Languages

Language:Scala 100.0%