https://github.com/chrisleekr/image-optimisation
Image Optimisation Service
https://github.com/chrisleekr/image-optimisation
continous-integration imagemin microservice nodejs optimise-images
Last synced: 25 days ago
JSON representation
Image Optimisation Service
- Host: GitHub
- URL: https://github.com/chrisleekr/image-optimisation
- Owner: chrisleekr
- License: mit
- Created: 2020-05-15T10:22:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-12T01:58:57.000Z (over 2 years ago)
- Last Synced: 2025-06-06T03:14:38.135Z (10 months ago)
- Topics: continous-integration, imagemin, microservice, nodejs, optimise-images
- Language: JavaScript
- Homepage: https://image-optimisation.chrislee.kr
- Size: 8.33 MB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Optimisation Service
[](https://github.com/chrisleekr/image-optimisation/actions?query=workflow%3Amain) [](https://codecov.io/gh/chrisleekr/image-optimisation) [](https://github.com/chrisleekr/image-optimisation/blob/master/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
```bash
$ curl -v -X POST -F "image=@sample1.jpg" https://image-optimisation.chrislee.kr/image -o sample1-output.jpg
```
### Pass remote image URL to optimise
```bash
$ 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
```bash
$ docker-compose up -d
```
Once docker containers are up, then you can access services with below URL.
| Service | Endpoint |
| ------- | ---------------------------------------------- |
| API | [http://localhost:3001](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`
```text
volumes:
- ./:/srv
```
Please make sure you run `npm install`.
### Routes
- POST `/image`
- Fields:
- `image`: image file
- `url`: remote image URL