Integrate from my previous Java Springboot app
Now running on Docker 🙌
An library book loaning system app to showcase Java on Springboot with Postgres to demostrate the RDBMS (Relational Database Management System).
It is a software platform that allows you to build, test & deploy your application easily. When Docker runs, it packed your app into units called containers. It then pull informations from your Dockerfile
and docker-compose.yml
file to include the libraries, system tools & database so that your application can run on Docker.
The best of all is that NO INSTALLATION and NO SETUPS of other software is needed. All you need is to install Docker Desktop
and sign-in.
Here's the link download Docker Desktop
Ensure that you sign-in to your Docker Desktop account.
- Clone this project.
- Run
docker compose up
on you WSL terminal from the root folder (same directory as the Dockerfile)
docker compose up
- It takes around 5-8mins to build the app. Depending on your speed.
- That's all. It's done!
If any codes/contents were modified, then use the --build flag:
docker compose up --build
1. Access the endpoint using thunder-client
or Postman
.
http://localhost:8080/learners
http://localhost:8080/books
2. Perform Authentication
Username: user
Password: password
3. Once authenticated, you should see the contents in both the endpoints.
!! Pls note that your id value
might varies from mine. Not to worry.
4. CREATE a new Learner & Book
Run the JSON code below. You should see the 201
return code if successful.
Select POST and enter the URL:
http://localhost:8080/learners
{
"firstName": "Helen",
"lastName": "Wick",
"email": "[email protected]",
"contact_num": "99123456",
"loanPeriod": []
}
Select POST and enter the URL:
http://localhost:8080/books
{
"title": "Rich Dad Poor Dad",
"author": "Robert Kiyosaki",
"genre": "Personal Finance",
"quantity": 4,
"availability": true,
"loanPeriod": []
}
5. UPDATE a Learner & Book
Now that we learnt how to CREATE
. It's time for UPDATE.
Run the JSON code below. You should see the 200
return code if successful.
Select PUT and enter the URL:
http://localhost:8080/learners/37
{
"firstName": "Bowery",
"lastName": "King",
"email": "[email protected]",
"contact_num": "99912345",
"loanPeriod": []
}
Select PUT and enter the URL:
http://localhost:8080/books/37
{
"title": "The Return of the King",
"author": "J. R. R. Tolkien",
"genre": "Fantasy",
"quantity": 3,
"availability": true,
"loanPeriod": []
}
6. DELETE a Learner & Book
No need to input JSON content when deleting.
You should see the 204
return code if successful.
Select DELETE and enter the URL:
http://localhost:8080/learners/37
Select DELETE and enter the URL:
http://localhost:8080/books/37