This service accepts image and returns resized thumbnail through RESTful APIs. It consists of two separate applications:
image_resize_api
: the RESTful API server, responsible for accepting new image and returning resized thumbnailimage_resize_worker
: the worker app, responsible for getting new job fromKue
work queue and resize using imagemagick
The image_resize_api RESTful API server uses the following:
- Docker as the container service.
- Node.js as the run-time environment to run JavaScript.
- Express.js as the server framework.
- Redis as the datastore for image as well as work queue.
- Kue as the work queue.
- Mocha as the test framework.
- Chai as the assertion library.
- Sinon as the stubbing library for test targets dependency stubbing.
- chai-as-promised for asserting promise.
- Multer for uploading image.
The image_resize_worker worker uses the following:
- Docker as the container service.
- Node.js as the run-time environment to run JavaScript.
- Redis as the datastore for image as well as work queue.
- Kue as the work queue.
- gm as nodejs wrapper library for imagemagick
- Mocha as the test framework.
- Chai as the assertion library.
- Sinon as the stubbing library for test targets dependency stubbing.
- Proxyquire to proxy nodejs's require (Kue)
First download and install Docker Desktop or Linux equivalent.
- Run
docker-compose up
to start three containers:- the Node.js API server app container
- the redis datastore container
- the worker app container
- Server is accessible at
http://localhost:3000
from host machine.
Tests are run outside of docker container. You should be able to run npm install
followed by npm test
to run everything (assuming you Node installed on your machine), commands must be run from inside root directory of respective apps
Uploaded images are stored in /uploads
directory, Resized images are stored in /thumbs
directory