This Node.js API, built with TypeScript and Fastify, allows you to perform various image processing tasks. It leverages parallel computing, async/await, and promises to efficiently process images using the Sharp package. The API offers the following features:
-
Upload Files by URL: You can upload images from external URLs.
-
Upload Files via Direct Upload: You can also upload images directly to the API.
-
Apply Watermark: Apply watermarks to existing images.
Follow these instructions to set up and run the Image Processing API on your local machine.
- Node.js v18 and npm installed on your system.
- Clone this repository to your local machine.
git clone https://github.com/GiovanniOliveira75/image-processing-api.git
- Navigate to the project directory.
cd image-processing-api
- Install the required dependencies.
npm install
- Start the API server.
npm run dev
- Use API endpoints to perform image processing tasks.
POST /process-images-from-url
: Upload images from URLs.POST /process-images-from-upload
: Upload images via direct file upload.POST /apply-watermark
: Apply watermarks to existing images.
You can configure the API by modifying the .env
file. This file could contain the following variables:
PORT
: The port on which the API server will run. Defaults to3000
.NODE_ENV
: The environment in which the API will run. Defaults todev
.APP_URL
: The URL of the API. Defaults tohttp://localhost:3000
.
- The Fastify and Sharp communities for their excellent libraries.