Skip to content

Latest commit

 

History

History

ms-book-quarkus-rest-jdbc

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Book API :: Quarkus and Jdbc

Overview

Microservice responsible to manager books providing endpoints to get a list of books and retrieve a book by Id.

Entity Relationship Diagram (DER)

Alt text

ℹ️ Project to create the book database book-database

API

Get Book by Id

Endpoint Method Description
/v1/books/{id} GET Return detail of specified book

Example

GET /v1/books/1

Response

{
  "id": 1,
  "title": "The World's First Love: Mary  Mother of God",
  "isbn": "8987059752",
  "languageId": 2,
  "numPages": 276,
  "publicationDate": "1996-09-01",
  "publisherId": 1010
}

Get list Books

Endpoint Method Description
/v1/books GET Return list of books

Example

GET /v1/books

Response

[
  {
    "id": 1,
    "title": "The World's First Love: Mary  Mother of God",
    "isbn": "8987059752",
    "languageId": 2,
    "numPages": 276,
    "publicationDate": "1996-09-01",
    "publisherId": 1010
  },
  {
    "id": 2,
    "title": "The Illuminati",
    "isbn": "20049130001",
    "languageId": 1,
    "numPages": 352,
    "publicationDate": "2004-10-04",
    "publisherId": 1967
  },
  {
    "id": 3,
    "title": "The Servant Leader",
    "isbn": "23755004321",
    "languageId": 1,
    "numPages": 128,
    "publicationDate": "2003-03-11",
    "publisherId": 1967
  }
]

Postman collection

Alt text

Build & Run

Local

mvn clean install

Execute o comando abaixo para rodar a aplicação.

java -jar ms-book-quarkus-rest-jdbc.jar

Docker

to build

docker build -f Dockerfile -t ms-book-quarkus-rest-jdbc:1.0.0 .

to run as a container

docker run -d -p 8080:8080  -i -t ms-book-quarkus-rest-jdbc:1.0.0

Docker Compose

build and run containers

docker-compose up --build

stop containers

docker-compose stop

In docker-compose.yml file:

  • Books Service : 8080 port is mapped to 8080 port of host
  • MySQL : 3306 port is mapped to 3306 port of host
  • Prometheus : 9090 port is mapped to 9090 port of host
  • Grafana : 3000 port is mapped to 3000 port of host

Port

8080

Grafana

Alt text

Attribute Value
URL http://localhost:3000
Username admin
Password admin
Port 3000

Alt text

Prometheus

Attribute Value
URL http://localhost:9090
Port 9090

Alt text

Alt text

VERSIONS

1.0.0

  • Quarkus 3.0.2
  • Java 17
  • Prometheus
  • Grafana
  • MySQL 8