Skip to content

Latest commit

 

History

History
96 lines (63 loc) · 2.72 KB

File metadata and controls

96 lines (63 loc) · 2.72 KB

Image-Processing-API

An image processing API that resizes and saves images to user specifications when visiting a URL.

Dependencies

To install the dependencies for this project, run the following command:

npm install

Build & run the server

After installing the dependencies, run the follwing command to build typescript into javascript and save them in build folder:

npm run build

Start the Server:

npm start

This command will run the server on port 3000. The home page will be available through http://localhost:3000 Screen Shot 2021-07-16 at 11 40 38 PM

Linting

npm run lint

Screen Shot 2021-07-16 at 11 36 20 PM

Testing

npm run test

Screen Shot 2021-07-16 at 11 24 47 PM

API Endpoints

This project has two endpoint.

Homepage endpoint

General: Views all images without chanding their sizes.

HTTP method: GET.

Sample request:

http://localhost:3000/

Sample response:

Screen Shot 2021-07-16 at 11 41 21 PM

Resize endpoint

General: Changes the size of the images depending on the input.

Sample request:

http://localhost:3000/resize?w=500&h=400

Sample response:

Screen Shot 2021-07-16 at 11 41 13 PM

Middlewares

Page Not Found

When accessing an endpoint other than the discussed ones. Screen Shot 2021-07-16 at 11 43 24 PM

Logs

Prints info about the endpoints accessed, for development. Screen Shot 2021-07-16 at 11 44 23 PM

Errors handling

The website can deal with these types of errors:

  1. 404 – Page not found.
  2. No images to resize.
  3. No Parameter provided to resize.

References

  1. Node.js Documentation.

  2. Express Documentation.

  3. Resize API.