slouc / typelevel-stack

Small HTTP web server with a simple backend, implemented using typelevel libraries (cats, http4s, doobie, circe, etc.) and packaged via docker-compose.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typelevel stack backend

This project contains a small skeleton of a simple web server. It provides a schoolbook way of building a simple backend from basic parts, mostly coming from the typelevel stack.

Libraries:

SBT plugins:

It uses docker-compose to pack the server together with a PostgreSQL database. This is useful for running the server locally.

Server defines two endpoints:

  • GET /users/[UUID] for fetching users from the database
  • POST /users for adding users to the database

First spin up docker and populate the database, then run the server:

> docker-compose up &
> sbt
sbt:typelevelstack> flywayMigrate
sbt:typelevelstack> run 

You can try out the server by issuing

> curl localhost:8080/users/f33f4247-938b-49cc-b8f7-a01d138ff26f
> curl -X POST localhost:8080/users  --data '{"email":"xyz@gmail.com"}'

About

Small HTTP web server with a simple backend, implemented using typelevel libraries (cats, http4s, doobie, circe, etc.) and packaged via docker-compose.


Languages

Language:Scala 100.0%