Skip to content

About

No description, website, or topics provided.

Resources

Stars

15 stars

Watchers

2 watching

Forks

Repository files navigation

Spring Boot with Liquibase and R2DBC

This is a Demo project which purpose is to showcase a small service which uses Liquibase for a tutorial I wrote. During the making of this project I wanted to also try a Reactive approach to connect with the Database by using R2DBC.

The API reads from a database with the following tables and relations.

Requirements

Running this project

  1. Install Docker Desktop if you haven't.

  2. Run the script re-start-local-postgres.sh located in the scripts folder to spin up a local version of the Postgres database.

scripts/stop-local-postgres.sh    
  1. Run the app with gradle
 ./gradlew clean bootRun

When the app runs, the Liquibase plugin will run too and the main-changelog.yml will execute all the database changes on it.

Available endpoints

This project includes a Postman Collection that you can download to see requests examples for each endpoint. The following table describes briefly each endpoint.

Method Endpoint Description
GET /sizes List all available sizes. This project contains pre-defined sizes, uploaded through a Liquibase dataset, check the dataset.prod.sql file.
GET /colors List all available colors. This project contains pre-defined colors, uploaded through a Liquibase dataset, check the dataset.prod.sql file.
GET /products List all available products, by default is empty. Use the POST /products endpoint to add products.
GET /products/{product_id} Get the details of a specific product. By default the products table is empty. Use the POST /products endpoint to add products.
POST /products Creates a product, you can include colors and sizes associated to the product. See the Postman Collection included in the project to see a request example.
PUT /products/{product_id} Updates a product including its associated colors and size. See the Postman Collection included in the project to see a request example. If no colors or sizes are included all associated colors or sizes will be removed.
DELETE /products/{product_id} Deletes a product and the colors and sizes associated to it.
GET /products/{product_id}/colors List the colors associated to a product. Notice you get the same colors when requesting the details of a product.
GET /products/{product_id}/sizes List the sizes associated to a product. Notice you get the same sizes when requesting the details of a product.

About

No description, website, or topics provided.

Resources

Stars

15 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages