In this project an API rest with http4s
, cats
, doobie
, skunk
was created.
Using Type-Classes and Tagless Final.
- JDK >= 1.8
- Scala 2.13.x
- Docker
- Docker Compose
$ docker-compose up -d
$ sbt flywayMigrate
$ sbt compile run
$ sbt assembly
$ sbt test
$ sbt it:test
$ sbt scalafmtSbt
$ sbt scalafmtAll
$ sbt exec
$ curl --location --request POST 'http://localhost:8080/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "username1",
"password": "password1"
}'
$ curl --location --request GET 'http://localhost:8080/products' \
--header 'Authorization: Bearer ${YOUR_ACCESS_TOKEN}'
$ curl --location --request GET 'http://localhost:8080/products/{UUID}' \
--header 'Authorization: Bearer ${YOUR_ACCESS_TOKEN}'
$ curl --location --request POST 'http://localhost:8080/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${YOUR_ACCESS_TOKEN}' \
--data-raw '{
"name": "Your Product Name",
"stock": 30.0
}'
$ curl --location --request PUT 'http://localhost:8080/products/{UUID}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${YOUR_ACCESS_TOKEN}' \
--data-raw '{
"name": "Your New Product Name",
"stock": 32.0
}'
$ curl --location --request DELETE 'http://localhost:8080/products/{UUID}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${YOUR_ACCESS_TOKEN}'
$ curl --location --request GET 'http://localhost:8080/trace'
Add ws://127.0.0.1:8080/trace/websocket
to Websocket Client