an API that can be used to serve properly scaled versions of images to reduce page load size. The API will handle resizing, formating and serving stored images based on URL parameters.
The goal of this project is to provide the building blocks for an enterprise-level solution that can handle hundreds of images with multiple thumbnail sizes, such as for an eCommerce application.
With best practices for creating scalable, maintainable code using TypeScript, unit testing, linting, and formatting to ensure a scalable, maintainable, less error-prone, and easy to read application.
$ npm install
$ npm start
Note: you can also run the app by using the node command: node build/index.js
$ npm test
To use this project, follow these steps:
- Drop an image into the
full
folder within theassets
directory. - Visit the endpoint
(http://localhost:3000/api/images)
in your browser. Enter the image name, width, and any optional parameters (height, extension, and processing style). - The processed image will be displayed in the browser and saved in the
thumbs
folder. - Note: When the page is reloaded, the previously processed image will be served to the client instead of being reprocessed.
/api/images
(http://localhost:3000/api/images/?filename=fjord&width=300)
filename
: Name of the image filewidth
: Width parameterheight
: Height parameter (optional)style
: Colour manipulation scheme (optional:tint
,greyscale
)ext
: Extention parameter for other image formats than JPG (optional) (default:jpg
)