Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

improcroute

This project was made to complete the job test assignment for backend developer position @ubersnap.

Build & deploy instructions

Manual

Debian

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/improcroute

IPR_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.

Using Docker

# Build
podman build -t improcroute .

# Run
podman run -d -p 127.0.0.1:8080:8080 -e IPR_PORT=8080 -e IPR_CORS_ORIGIN=\* improcroute

Alternatively, 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/improcroute

Demo Client

cd demo
go run .&
open http://localhost:8081

Make sure to run the server too, and ensure the IPR_CORS_ORIGIN environment variable includes the client's origin (http://localhost:8081).

API

POST /PngToJpg

Converts a PNG file to JPG.

  • Request MIME types: image/png
  • Response MIME types: image/jpg
  • Query string parameters: none

POST /ResizeImage

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 int REQUIRED, height int REQUIRED

POST /CompressImage

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

About

ubersnap backend developer task assignment

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages