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:
- scalafmt for code formatting
- flyway-sbt for database migrations.
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 databasePOST /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":"[email protected]"}'