This is an image processing API Project. Images can be queried and resized within the browser.
To access the images, navigate to localhost:3000/api and enter the valid parameters to see the image resized in the browser.
Once the image is resized, a copy will be created in the thumb folder in your local directory.
The project can be built and run in the following ways
npm i
npm run build
This command will build the typeScript code into JavaScript and save them in the ./build
folder.
npm run start
(For Development)
AND
npm run start:prod
(For Production)
This command will start the server running on port 3000
.
- -> Check
Package.json
for information.
Here, I will show you how to run the test and also how to check that our code respects all the eslint rules.
npm run format
This script contains formating and linting the application.
npm run test
This script builds the application and runs testing using jasmine.
-
-> Method:
get
-
-> URL Params:
height
andwidth
- the height or width of the image in pixels -
-> Query Param:
filename
- the specific image you are requesting. -
-> You can find the Images list using GET
/api/imageslist
as a JSON resultFor example:
localhost:3000/api/images?filename=fjord&width=800&height=400
encenadaport
fjord
icelandwaterfall
palmtunnel
santamonica
- -> User can query api endpoint using various parameters and queries to retrieve an image with a specified height and width.
- -> All images requested will be saved to local disk.
- -> If a user requested an image that has already been created, the previously cached image will be returned.
- -> Entering incorrect parameters will not be processed and error message will apear to user
- NodeJS - The JavaScript runtime.
- Express - The web framework.
- TypeScript - The language used.
- Jasmine - The Testing framework used.
- Sharp - NodeJS image processor.