Challenge Overview
CHALLENGE OBJECTIVES
TECHNOLOGY STACK
PROJECT MIGRATION
API ENDPOINTS
After this project migration has happened, we need the following API endpoints to be implemented.
Cropping- /api/images/crop
Available parameters
Rotation - /api/images/rotate
Available parameters
Transparency - /api/images/transparency
Available parameters
Cropping - /api/images/convert
Available parameters
IMAGE TYPES
At least these image types must be supported: JPG, PNG, TIFF, GIF, WebP, HEIF The endpoint should make sure file with invalid file formats are rejected.
PREFERRED NODE MODULES
EXPECTED RESULT
- We are building an image processing (micro) service and in this iteration we want to focus on cropping, rotation, transparency and file format transformation of images.
- The micro service provides a REST API where we can send the multipart/form-data of file and several input parameters. As a response we want to receive the transformed image.
TECHNOLOGY STACK
- Node.js
- Typescript
- REST
PROJECT MIGRATION
- The attached project package contains two directories: image-processor and lerna-project.
- Image-processor must be migrated into lerna-project/packages/server. Replace all logging with the @enchanted/logger and use @enchanted/tslint for linting.
API ENDPOINTS
After this project migration has happened, we need the following API endpoints to be implemented.
Cropping- /api/images/crop
Available parameters
- topLeftX: integer. Defines the top left X coordinate of the rectangle cropping area
- topLeftY: integer. Defines the top left Y coordinate of the rectangle cropping area
- bottomRightX: integer. Defines the bottom right X coordinate of the rectangle cropping area
- bottomRightY: integer. Defines the bottom right Y coordinate of the rectangle cropping area
Rotation - /api/images/rotate
Available parameters
- rotation: integer. Defines the angle of rotation of the image. Positive numbers are clockwise, negative are counter-clockwise.
Transparency - /api/images/transparency
Available parameters
- opacity: integer. Value between 0 and 100. Defines the opacity of the image. Images must be transformed and return in a file format that supports transparency (preferred is PNG)
Cropping - /api/images/convert
Available parameters
- fileType: string. Target filetype, one of the defined Image Types below
IMAGE TYPES
At least these image types must be supported: JPG, PNG, TIFF, GIF, WebP, HEIF The endpoint should make sure file with invalid file formats are rejected.
TECH REQUIREMENTS
- Programming language used must be node.js written in typescript.
- The provided project skeleton must be used for implementation
- Code must be properly documented
- The provided linting configuration must be used
- Every implemented functionality must be tested by unit-tests
- All packages used for this implementation must be MIT, BSD or Apache 2.0
- Every defined port, host etc. should be put in central variables / configurations for easy re-configuration (if applicable).
- The express based components of this implementation must be based on https://tsed.io/
- tslint must show no errors inside IDE (VSCode) and on Command Line
- Please see the below list of preferred node_modules and stick to it. Exceptions from this list must be provided with a reason.
- Do not use unmaintained or deprecated node_modules
- The existing API documentation needs to be expanded with the new features.
- The existing project must be expanded with the REST APIs required
PREFERRED NODE MODULES
- HTTP Requests: Axios
- Logging: @enchanted/logger
- Linting: @enchanted/tslint
EXPECTED RESULT
- The service needs to provides API endpoints which accept multipart/form-data as input
- The service accepts a file and the parameters described above
- The service respond to a correct request with the transformed image
- The service provide proper HTTP status codes on error
- All technical requirements mentioned are covered.
Final Submission Guidelines
- Full code that covers all the requirements.
- A detailed README file including information on how to setup and run your application.