This project was made to complete the job test assignment for backend developer position @ubersnap.
I assume go tool has been installed on your system and can be called through the go command.
# Install dependencies
sudo apt install libopencv-core-dev libopencv-imgproc-dev libopencv-imgcodecs-dev cmake build-essential
# Get source and build
git clone https://github.com/fuad1502/improcroute.git
cd improcroute
make
# Test
make test
# Run the server
IPR_PORT=8080 IPR_CORS_ORIGIN=\* ./build/improcrouteIPR_PORT specify which port to install the service to. IPR_CORS_ORIGIN specify allowed origins.
Note that the test will try to bind to port 8080, 8081, and 8082, ensure that those ports are free before testing.
# Build
podman build -t improcroute .
# Run
podman run -d -p 127.0.0.1:8080:8080 -e IPR_PORT=8080 -e IPR_CORS_ORIGIN=\* improcrouteAlternatively, use the docker image that I've pushed to dockerhub:
podman run -d -p 127.0.0.1:8080:8080 -e IPR_PORT=8080 -e IPR_CORS_ORIGIN=\* fuad1502/improcroutecd demo
go run .&
open http://localhost:8081Make sure to run the server too, and ensure the IPR_CORS_ORIGIN environment
variable includes the client's origin (http://localhost:8081).
Converts a PNG file to JPG.
- Request MIME types: image/png
- Response MIME types: image/jpg
- Query string parameters: none
Resize the given image to the specified width and height. The resulting image is converted to PNG regardless of the original format.
- Request MIME types: image/png, image/jpg, image/jpeg
- Response MIME types: image/png
- Query string parameters:
width intREQUIRED,height intREQUIRED
Compress the given image using JPEG compression with the specified quality value. Lower quality value results in lower quality image, but higher compression ratio. The resulting image is converted to JPG regardless of the original format.
- Request MIME types: image/png, image/jpg, image/jpeg
- Response MIME types: image/jpg
- Query string parameters:
quality int[0-100] REQUIRED
