Skip to content

eggOnion/SimpleLibrary_onDocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Simple Library App


Integrate from my previous Java Springboot app

Now running on Docker 🙌

What this app does?

An library book loaning system app to showcase Java on Springboot with Postgres to demostrate the RDBMS (Relational Database Management System).


What is Docker?

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


How to run

Ensure that you sign-in to your Docker Desktop account.

  1. Clone this project.
  2. Run docker compose up on you WSL terminal from the root folder (same directory as the Dockerfile)
docker compose up
  1. It takes around 5-8mins to build the app. Depending on your speed.
  2. That's all. It's done!

dockercomposeup


If any codes/contents were modified, then use the --build flag:

docker compose up --build

How to use the app

Ensure that docker compose up runs successfully.


1. Access the endpoint using thunder-client or Postman.

http://localhost:8080/learners
http://localhost:8080/books

2. Perform Authentication

Authentication

Username: user
Password: password


3. Once authenticated, you should see the contents in both the endpoints.

View_Learners&Books

!! 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.

CREATE_Learners

Select POST and enter the URL:

http://localhost:8080/learners
{
    "firstName": "Helen",
    "lastName": "Wick",
    "email": "[email protected]",
    "contact_num": "99123456",
    "loanPeriod": []
}

CREATE_Books
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": []
}

Check out the results!

View_addedLearners

View_addedBooks


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.

updateLearner

Select PUT and enter the URL:

http://localhost:8080/learners/37
{
    "firstName": "Bowery",
    "lastName": "King",
    "email": "[email protected]",
    "contact_num": "99912345",
    "loanPeriod": []
}

updateBooks

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.

deleteLearner
Select DELETE and enter the URL:

http://localhost:8080/learners/37

deleteBooks
Select DELETE and enter the URL:

http://localhost:8080/books/37

References

Docker

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published