An image delivery microservice. The height and weight of the image are sent as GET parameters in the URL and resized image is cached on the server in public/cache
folder. The original images are located in public
.
Every image request is logged into a mysql database.
Build/rebuild and start the docker containers for debuging
# sh cmd/rebuild.sh
For production:
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
Tests:
# npm run test
Request image by using this url: /img/[image-name]?size=[height]x[width]
Example: http://localhost:3000/img/alejandro-escamilla-9-unsplash.jpg?size=300x200
Statisctics page:
- Implement
dotenv
- Extend tests
- Better DataBase service
- Code documentation
- Better variable naming
There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton
based on https://github.com/microsoft/vscode-recipes/tree/master/Docker-TypeScript