Quarkus app that exposes an API for managing books. It runs in Native mode and uses MySQL
1.4K
quarkus-jpa-mysql-native is a Java web application developed with Quarkus, leveraging GraalVM Native Image to achieve native compilation. 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_native -e MYSQL_ROOT_PASSWORD=secret \
--network jpa-mysql-network \
mysql:8.2.0
Start quarkus-jpa-mysql-native
docker run -d --rm --name quarkus-jpa-mysql-native -p 8080:8080 \
-e MYSQL_HOST=mysql -e QUARKUS_PROFILE=database-generation-update,native \
--network jpa-mysql-network \
ivanfranchin/quarkus-jpa-mysql-native: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-native mysql
docker network rm jpa-mysql-network
Content type
Image
Digest
sha256:925d584ac…
Size
70 MB
Last updated
5 months ago
docker pull ivanfranchin/quarkus-jpa-mysql-native