Skip to content

🐦 Random bird photos powered by Ktor, FreeMarker, & Unsplash API.

License

Notifications You must be signed in to change notification settings

bog-walk/random-bird

Repository files navigation

🐦 Random Bird 🦜🦩🦉

Random bird app gif

Enjoy the beauty of birds without the need to travel using the combined power of Ktor and the Unsplash Image API.

📝 Web App details

A minimalist web page with the sole purpose of being a link between the client (a.k.a. the ornithophile ❤️) and a collection of high-quality bird images. Currently only two options are available:

  • Getting a random ball of feathers with every page reload
  • Getting the 3 top-liked results from the first page of the latest bird images on Unsplash

💼 Features

  • Frontend entirely reliant on Ktor serving FreeMarker templated content
  • Requests to the Unsplash API handled by Ktor's HttpClient
  • JSON deserialization into nested data classes using the ContentNegotiation plugin
  • Unit testing of the HTTP client using MockEngine
  • Image creator attribution with ❤️ and a direct link to their Unsplash profile

💻 Run web app

Swap out the accessKey placeholder in UnsplashClient for your own access key from the Unsplash API.

Clone the repository then pick an option:

  • ./gradlew run from an open terminal in the root of the project

  • Open the project in IntelliJ IDEA and run Application.kt

  • Open the Gradle toolbar and select random-bird/Tasks/application/run

Open the logged url http://localhost:8080/ in a browser.

🔬 Run tests

Clone the repository then pick an option:

  • Open the project in IntelliJ IDEA then choose specific tests using gutter icons or right-click the src/test folder and select Run 'Tests in 'random-bird.test''

  • Open the Gradle toolbar and select random-bird/Tasks/verification/test