Table of Contents
Hello!
I knew I wanted to build this with Spring Boot because I'm most familiar with Java honestly but I haven't specifically worked with this framework before. For the database I figured noSql would be the most simple. I was going to use Firebase but just decided to try MongoDB instead. For the public apis I Googled a different site with a cat api which also happened to have a dog api, no bears unfortunately. I initially wanted to use these endpoints because they advertised a parameter to get multiple images but turns out their limit parameter does not work right! So it is a single call per image.
Thanks :)
You'll need Docker to run this application if you don't already have.
- Go to the official Docker page: https://www.docker.com/get-started
- Install according to your OS
- Follow installation steps, most likely will need to restart, do that if prompted
- Open a terminal on your machine and run these just to verify
docker --version
docker compose versionClone and go
- Open a terminal on your machine and navigate to the directory where you want to clone the repo
cd chosen/path/example - Clone the repo
git clone https://github.com/lizstevens/image-service.git
- Navigate to the project
cd image-service - Spin up Spring Boot, MongoDB, and run automated tests
docker compose up --build
- Open a browser and navigate to http://localhost:8080/
- You should see the prompt page
To Fetch and save random images of cats or dogs select either cat or dog. Enter how many using the arrows in the box prompt. Press submit. The images saved will display from left to right in the order saved.
To get the latest saved image press Get Latest Saved. The latest saved image will display.