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 thephotos
collection andsizes
collection.
- Any updates/breaking-changes to
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