## Get the code
# Versions jdk 19 and spring boot 3.3.3
git clone https://github.com/jeethualex/spring.git
## Build project
gradle build
mvn clean install
## Local run
gradle bootRun
## Run the jar file - with gradle
java -jar .\build\libs\demo-0.0.1-SNAPSHOT.jar
## Run the jar file - with maven
java -jar .\target\demo-0.0.1-SNAPSHOT.jar
###### GREETINGS ######
## launch urls below
# http://localhost:8080/hello
curl http://localhost:8080/greeting
curl http://localhost:8080/hello
# http://localhost:8080/hello?name=G2
curl http://localhost:8080/greeting?name=G2
curl http://localhost:8080/hello?name=G2
###### EMPLOYEES CRUD ######
## before running these commands will need a local mysql database
## server installed with 2 env variables
## will create a spring database with employee table
## Env variables needed to be added on windows are MYSQl_USER and MYSQL_PASS
## Create Employees
curl --location 'localhost:8080/employee' \
--header 'Content-Type: application/json' \
--data '{
"name":"jeetu",
"department":"IT"
}'
## Get all Employees
curl --location 'localhost:8080/employees' \
--header 'Content-Type: application/json'
## Get Employee
curl --location 'localhost:8080/employee/1' \
--header 'Content-Type: application/json'
## Delete Employee
curl --location --request DELETE 'localhost:8080/employee/4' \
--header 'Content-Type: application/json'
## Update Employee
curl --location --request PUT 'localhost:8080/employee' \
--header 'Content-Type: application/json' \
--data '{
"id":"1",
"name":"jeetu",
"department":"HR"
}'
###### CUSTOMER JDBC ######
curl http://localhost:8080/customer?name=G2
# Check the logs for db queries
# Try the postman collection
References :
0 comments :
Post a Comment