chrisleekr / image-optimisation

Image Optimisation Service

Home Page:https://image-optimisation.chrislee.kr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Optimisation Service

Build CodeCov MIT License

This is a practice project. The project contains Node.js API that optimise images - jpg, png, svg, and gif.

  • Node.js, Express, Webpack, Imagemin

Demo

Post local image to optimise

$ curl -v -X POST -F "image=@sample1.jpg" https://image-optimisation.chrislee.kr/image -o sample1-output.jpg

Pass remote image URL to optimise

$ curl -v -X POST "url=https://raw.githubusercontent.com/chrisleekr/image-optimisation/master/examples/sample1.jpg" https://image-optimisation.chrislee.kr/image -o sample1-url-output.jpg

How to start in your local environment

$ docker-compose up -d

Once docker containers are up, then you can access services with below URL.

Service Endpoint
API http://localhost:3001

API

API docker container will be launched as development mode with nodemon. However, it won't detect any changes unless uncomment volumes.

To enable live change for the API, simply uncomment following lines in docker-compose.yml

  volumes:
    - ./:/srv

Please make sure you run npm install.

Routes

  • POST /image
    • Fields:
      • image: image file
      • url: remote image URL

About

Image Optimisation Service

https://image-optimisation.chrislee.kr

License:MIT License


Languages

Language:JavaScript 98.6%Language:Dockerfile 1.4%