CRUD(Create, Read, Update, Delete) Spring boot with database postgres

1. create database

docker run -d --name psql
-e POSTGRES_USER=psql
-e POSTGRES_PASSWORD=password
-p 5432:5432
postgres:14

2. Run

add product

curl --location 'http://localhost:8080/products'
--header 'Content-Type: application/json'
--data '{ "name":"Keyboard", "qty":25 }'

image info

get product by id

curl --location 'http://localhost:8080/products/55992d28-b715-403c-98e7-8f266bd5837d'

image info

update product

curl --location --request PUT 'http://localhost:8080/products'
--header 'Content-Type: application/json'
--data '{ "id":"55992d28-b715-403c-98e7-8f266bd5837d", "name":"Logitech Keyboard", "qty":25 }'

image info

get products

curl --location 'http://localhost:8080/products'

image info

delete product

curl --location --request DELETE 'http://localhost:8080/products/55992d28-b715-403c-98e7-8f266bd5837d'

image info