Download images from flickr feed.
- Start the application:
lein run
- Download images from flickr feed.
curl -X POST http://localhost:8080/api/flickr/feed \
-H "Content-Type: application/json" \
-d '{"limit": 5, "size": {"width": 50, "height": 50}}' -v
- Downloaded images default location:
{project}/flickr/photos/
There is no required attribute.
attr | |
---|---|
limit | specify the number of images to return |
size | specify a resize width and height, ex: {"width": 120, "height": 120} |
limit, size/width and size/height must be positive numbers greater than zero.
status | |
---|---|
200 | Success, but no images were saved. |
201 | Success with one or more images being created. |
400 | Invalid request payload. |
413 | No space left on disk. |
You can set the enviroment variable GALLERY_PATH
in order to choose where the
images will be saved.
lein test
- Start a new REPL:
lein repl
- Start the service in dev-mode:
(def dev-serv (run-dev))
- Connect your editor to the running REPL session. Re-evaluated code will be seen immediately in the service.
Docker container support
- Configure your service to accept incoming connections (edit service.clj and add ::http/host "0.0.0.0" )
- Build an uberjar of your service:
lein uberjar
- Build a Docker image:
sudo docker build -t flickr-fetcher .
- Run your Docker image:
docker run -p 8080:8080 flickr-fetcher
- Build and run your image:
capstan run -f "8080:8080"
Once the image it built, it's cached. To delete the image and build a new one:
capstan rmi flickr-fetcher; capstan build