Quarkus app that exposes an API for managing books. It runs in JVM mode and uses MySQL
1.5K
quarkus-jpa-mysql-jvm is a Java web application developed with Quarkus, specifically designed to run within a container in JVM mode. It exposes a REST API for managing books and uses MySQL as database. The source code for this project is available in the ivangfr/graalvm-quarkus-micronaut-springboot repository.
Ivan Franchin (LinkedIn) (Github) (Medium) (Twitter)
The application has the following endpoints:
MYSQL_HOST
Specify the hostname of the MySQL database. The default value is localhost
MYSQL_PORT
Specify the port of the MySQL database. The default value is 3306
Create network
docker network create jpa-mysql-network
Start MySQL container
docker run -d --rm --name mysql -p 3306:3306 \
-e MYSQL_DATABASE=bookdb_jvm -e MYSQL_ROOT_PASSWORD=secret \
--network jpa-mysql-network \
mysql:8.2.0
Start quarkus-jpa-mysql-jvm
docker run -d --rm --name quarkus-jpa-mysql-jvm -p 8080:8080 \
-e MYSQL_HOST=mysql -e QUARKUS_PROFILE=database-generation-update \
--network jpa-mysql-network \
ivanfranchin/quarkus-jpa-mysql-jvm:1.0.0
Make some requests
Get all books
curl -i localhost:8080/api/books
Add book
curl -i -X POST localhost:8080/api/books -H 'Content-Type: application/json' -d '{"isbn": 123, "title": "Learn Docker in 5 minutes"}'
Get a specific book
curl -i localhost:8080/api/books/1
Cleanup
docker stop quarkus-jpa-mysql-jvm mysql
docker network rm jpa-mysql-network
Content type
Image
Digest
sha256:1d758f5ef…
Size
170.8 MB
Last updated
5 months ago
docker pull ivanfranchin/quarkus-jpa-mysql-jvm