Learning to build APIs with Scala Tapir
Run the following commands for quick startup and check
Sbt build tool config file
build.sbt
JVM options for Sbt
.jvmopts
Sbt version
project/build.properties
Project dependencies
project/Dependencies
Sbt plugins
project/plugins.sbt
Run Sbt build tool
sbt
⏎
Compile the application
compile
or ~compile
for continuous compiling
Manage the web server with Revolver plugin
reStart
, reStop
, reStatus
, or ~reStart
Check Swagger API:
Akka
implementation (aviation-api
module): http://localhost:8080/docsZIO
implementation (aviation-web
odule): http://localhost:8081/docs/Check Health endpoint (Akka)
http://localhost:8080/api/v1.0/health
curl -v http://localhost:8080/api/v1.0/health | jq
Run the test suites
test
or ~test
for continuous testing
Reload changes in build.sbt config file
reload
Clean target
working directory
clean
Check dependencies with command line and browser
dependencyUpdates
, dependencyBrowseTree
, dependencyList
, dependencyTree
Exit Sbt
CTRL + D
Rapid test cycle via continuous testing with a single suite test:
~testOnly com.cmartin.learn.api.ActuatorApiSpec
Rapid test cycle via continuous testing with a single test:
~testOnly com.cmartin.learn.api.ActuatorApiSpec -- -z "keyword"
module: tapir-webapp/reStart
bash command: httpie
http -v "http://localhost:8080/api/v1.0/health"
http -v "http://localhost:8080/api/v1.0/transfers/1"
http -v "http://localhost:8080/api/v1.0/transfers/404"
http -v "http://localhost:8080/api/v1.0/transfers/500"
echo '{"sender":"ES11 0182 1111 2222 3333 4444",
"receiver":"ES99 2038 9999 8888 7777 6666",
"amount":100.0,
"currency":"EUR",
"date":"2020-11-07T08:05:13.345Z",
"desc":"Viaje a Tenerife"}' \
| http -v http://localhost:8080/api/v1.0/transfers
Asynchronous non-blocking appender config
Basic standard configuration
https://doc.akka.io/docs/akka/current/general/configuration.html
tapir-webapp/src/main/resources/application.conf