https://github.com/sysgears/scala-tapir-akka-http-example
https://github.com/sysgears/scala-tapir-akka-http-example
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sysgears/scala-tapir-akka-http-example
- Owner: sysgears
- License: mit
- Created: 2022-08-25T13:14:27.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-30T15:36:43.000Z (almost 4 years ago)
- Last Synced: 2025-03-28T23:22:00.263Z (about 1 year ago)
- Language: Scala
- Size: 109 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tapir Akka-Http
Advanced back-end service with Tapir, Akka-Http, Quill and Macwire
Task - create service, similar to some kind of shop using Tapir with
Akka-Http interpreter, Quill, Macwire and circe json.
This example contains:
- work with database using Quill
- Simple jwt authentication and role authorization to access some endpoints
- sign in and sign out endpoints
- error handling customization
- failed decoding customization
- request wrappers (request handling time tracker)
- adding prometheus metrics
- connecting swagger docs
- set and describe http codes for error response
- Tapir endpoints testing, including mocking security
Also example contains Quill as library which works with database, similar to Slick and Macwire, which works similar to Guice.
Note: to run this example in first time, you have to apply sql scripts from resource directory!
Stack
-
- Tapir v1.0.3
- Akka-Http
- Quill v4.2.0
- Circe json 0.14.2
- Macwire v2.5.7
- Scalatest, Mockito (testing)
Useful links
-
- Quill documentation: https://getquill.io/
- Tapir documentation: https://tapir.softwaremill.com/en/latest/index.html
- Macwire github: https://github.com/softwaremill/macwire
- Circe documentation: https://circe.github.io/circe/
- Measuring response time in akka http (took implementation from there): https://blog.softwaremill.com/measuring-response-time-in-akka-http-7b6312ec70cf
- Tapir endpoints testing: https://tapir.softwaremill.com/en/latest/testing.html