Skip to content

An api that resizes, caches, and serves images on demand.

Notifications You must be signed in to change notification settings

OmarMAttia7/image-processing-api

Repository files navigation

Image Processing API

A simple image processing API, made as a submission for Udacity"s back-end development with NodeJS course first project.

Table of Contents

Compile and Run

  1. run npm install to install dependencies
  2. run npm run build to compile TypeScript
  3. run npm run start to start the application

You can also start the development server without compiling by running npm run dev

The project was made in the current Node LTS version 16.18.0.

Testing

run npm run test to run all tests.

The tests cover the functionality of the /api/images endpoint as well as tests for the functions in the api/services directory.

The /tests directory currently compiles inside the /dist directory, it should be possible to separate them using another tsconfig file but I haven"t had the chance to experiment with it yet.

Formatting and Linting

  • npm run format to run prettier and automatically fix formatting errors.
  • npm run lint to run ESLint on the source code without fixing errors.
  • npm run lint:fix to run ESLint on the source code and fix all fixable errors.
  • npm run lint-format runs the lint:fix and format scripts.

Usage

The only current endpoint is /api/images/, upon requesting it you should be able to see simple instructions on how to use the image resizing functionality.

You can request /api/images/:image to get the full sized image if it exists. Request /api/images/:image?width={width}&height={height} to get a resized image with the dimensions {width} and {height}.

Multiple Image Sizes and Extensions

Image Sizes

The application supports resizing to multiple sizes of the same image.

Extensions

I have only tested jpgs and pngs, but the application should be able to correctly handle any image format that has a MIME type starting with image/

About

An api that resizes, caches, and serves images on demand.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published