RESTful web application built in Vertx using vertx-pg-client and Reactive Vertx-ifed JOOQ library
- First in order to connect to existing database you must restore database using
vertx-jooq-cr-backup.tar
(located in root directory of this repo) in your DB tool (such as pgAdmin4) - Make sure that all parameters for database access (database name, db username, password, etc.) located in pom.xml file are properly set
- Change location in your terminal to be inside of "vertx-pg-reactive-jooq" project
- Run
mvn clean package
command - Run
sh ./redeploy.sh
(on Linux) orjava -jar ./target/vertx-pg-reactive-jooq-0.0.1-SNAPSHOT-fat.jar
Here are some API endpoints to target (using Postman or similar tool) including some JSON bodies for HTTP Request:
Get single Author with id=1 http://localhost:8080/api/authors/1
Get all Categories http://localhost:8080/api/categories
Get single Bookhttp://localhost:8080/api/books/1
Create Author http://localhost:8080/api/authors
{
"firstName": "Franz",
"lastName": "Kafka"
}
Create Category http://localhost:8080/api/categories
{
"name" : "Crime",
"isDeleted": false
}
Create Book http://localhost:8080/api/books
{
"title": "The Trial",
"price": 15.50,
"amount": 300,
"isDeleted": false,
"authors": [1],
"categories": [1]
}
Create Order http://localhost:8080/api/orders?username=mica
NOTE: In order this method to work user
table must contain a row with column username
that has a value 'mica'.
JSON Body:
{
"orders": [
{
"book_id": 1,
"amount": 4
}
],
"totalPrice": 62.00
}
Endpoints are same like in GET method section and you need to change same JSON body yourself by following format from POST methods section (JSON bodies are of course for PUT methods)