derekahn / backend-javascript-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Insitefulickr

A quick and fun challenge playing with Flickr's API.

PROS πŸ‘:

  • Clear seperation of concerns--allowing for scalability.
  • lib/* are small, light, portable, easily testable, and reusable in other projects.
    • lib/flickr methods are all pure and take a single argument with a consistent response of an array of objects (collection).

CONS πŸ‘Ž:

  • Safety Not Garunteed β€Ό
    • Any updates/breaking-changes to flickr-sdk could πŸ”© me.
    • lib/flickr.* is fragile and operates on the assumption of consistent data structures.
    • lib/flickr.formatting order matters for both the photos collection and sizes collection.

Architecture

.
β”œβ”€β”€ lib
β”‚   β”œβ”€β”€ async.js   # helpers for async things
β”‚   └── flickr.js  # interface for flickr-sdk
β”œβ”€β”€ routes
β”‚   β”œβ”€β”€ images.js  # handler for '/images'
β”‚   └── index.js
└── app.js         # express server

Setup

# Install πŸ“¦s
$ yarn install

# Specify a PORT? Else defaults to 8080
$ export PORT=5050

# Specify a LIMIT for titles? Else defaults to 10
$ export LIMIT=2

# Specify a URL_AMT per title? Else defaults to 2
$ export URL_AMT=5

# Use your own flickr πŸ”‘? Defaults to'80aafb8d5879b4ab3d58a6543021cd59'
$ export API_KEY='your_flickr_api_key'

Running localy 🏠

$ yarn start

$ curl http://localhost:8080/images?query=aloha

Dependencies

About


Languages

Language:JavaScript 100.0%