@augmt/image-search-abstraction-layer
v0.3.0
Published
Image Search Abstraction Layer
Readme
Image Search Abstraction Layer
Get image results through the Unsplash API.
How it Works
This microservice uses Monk to store and retrieve objects, unsplash-js and isomorphic-fetch to fetch results from the Unsplash API, and Koa and koa-router to serve requests.
How to Use
app.js exports a Koa app. Koa apps have an app.listen() method that is
identical to Node's http.Server.listen().
Import app.js and call app.listen() to start up the microservice.
Environment Variables
APPLICATION_ID- required to authenticate requests to the Unsplash APIMONGO_URI- your Mongo database's connection string
API Resources
GET /search
Get a list of sparse photo metadata for a query.
REQUEST
Sample: https://image-search-abstraction-layer.example.com/search?keyword=chickadee
QUERY PARAMETERS
| parameter | type | default | |-----------|--------|---------| | keyword | string | — | | offset | number | 1 | | per_page | number | 10 |
RESPONSE
Status: 200 - application/json
Response:
[
{
"user": {
"name": "Paulo Brandao",
"small": "https://images.unsplash.com/placeholder-avatars/extra-large.jpg…",
"html": "https://unsplash.com/@pbrandao"
},
"photo": {
"small": "https://images.unsplash.com/uploads/141155339325423394b24/03982423…",
"html": "https://unsplash.com/photos/YLgTmdb7r1o"
}
}
]GET /latest
Get a list of the latest queries.
REQUEST
Sample: https://image-search-abstraction-layer.example.com/latest
RESPONSE
Status: 200 - application/json
Response:
[
{
"keyword": "chickadee",
"when": "Sat, 01 Oct 2016 00:00:00 GMT"
}
]