Skip to content

Web service written in NodeJS that displays a kitten image randomly picked from Bing Images

License

Notifications You must be signed in to change notification settings

amercier/kitten-as-a-service

Repository files navigation

kitten-as-a-service

Web service written in NodeJS that displays a kitten image randomly picked from Bing Images.

Build Status Test Coverage Code Climate Greenkeeper

Created with npm-package-skeleton.

The web service exposes mainly two URLs:

  • /: a web page, written in HTML/CSS/JS
  • /kitten-{size}.jpg: the endpoint for the random image, which can be used programatically, where {size} is one of the following:
    • small: 480p or more, 30kB to 100kB
    • medium: 720p or more, 50kB to 300kB
    • large: 1080p or more, 100kb to 500kB
    • huge: 2160p or more, 500kB to 5MB

Demo

curl --progress-bar -L http://kitten.amercier.com/kitten-huge.jpg -o kitten-huge.jpg

Requirements

MacOS install instructions using Homebrew:

brew install nvm
nvm install node
npm install -g yarn

Local setup

  1. Clone this repository
git clone https://github.com/amercier/kitten-as-a-service.git
cd kitten-as-a-service
  1. Install dependencies
yarn install
  1. Start server
export MICROSOFT_AZURE_API_KEY=********* yarn start
  1. Visit http://localhost:3000/

Deployment

Deploy on a NodeJS server (ex: Heroku), with the following environment variables:

Also, you can set DEBUG to true to display more verbose logging.

License

This project is released under ISC License. All Microsoft, Bing, Azure brands are property of their respective owners. All pictures are property of their respective owners.