This is a simple REST API allowing users resize images using the Sharp Node.js image processing module.
After cloning the repo, all the project dependencies can be installed using npm:
npm i
To execute the application use the following command in terminal:
npm run start
the app will then be available on port 3000 by default
The following actions can be executed through npm scripts:
npm run build
A jasmine testing
npm run test
The code can be automatically formatted using prettier.
npm run format
The code can ba automatically linted using ESlint.
npm run lint
The API offers one endpoint to access and resize images available in the src/images
folder.
The endpoint is api/images
and requires three query params:
Query Param | Value |
---|---|
filename | the filename (without extension) of one of the images available in the folder |
height | it should be a positive integer and less than 1080 |
width | it should be a positive integer and less than 1080 |
An example of a correct endpoint call would be:
http://localhost:3000/api/images?fileName=palmtunnel&height=250&width=220