This project is an image compression service that allows users to upload CSV files containing image data for processing. The service utilizes a queue system for handling requests and provides status updates for each processing request.
- Clone the repository:
git clone https://github.com/nullfox-coder/Image-Compressor.git
- Navigate to the project directory:
cd Image-Compressor
- Install dependencies:
npm install
- create a .env file with the following format:
MONGODB_URI=xyz
CLOUDINARY_CLOUD_NAME=xyz
CLOUDINARY_API_KEY=xyz
CLOUDINARY_API_SECRET=xyz
PORT=8000
To run the application, use the following command:
npm start
For development, you can use:
npm run dev
-
POST /upload: Upload a CSV file for processing.
- Request Body:
webhookUrl
: (optional) URL to send notifications upon completion.
- Response:
requestId
: Unique identifier for the processing request.
- Request Body:
-
GET /status/:requestId: Check the status of a processing request.
- Response:
status
: Current status of the request.products
: List of processed products (if any).createdAt
: Timestamp of when the request was created.completedAt
: Timestamp of when the request was completed (if applicable).
- Response:
- axios: For making HTTP requests.
- bull: For handling job queues.
- cloudinary: For image storage and management.
- csv-parser: For parsing CSV files.
- dotenv: For loading environment variables.
- express: The web framework for building the API.
- mongoose: For MongoDB object modeling.
- multer: For handling multipart/form-data, used for file uploads.
- sharp: For image processing.
- uuid: For generating unique identifiers.
- winston: For logging.
http://34.46.28.212:8000
I have attached a sample_test_data.csv in my dir to test Just download the file and test with the given curl
curl --location 'http://34.46.28.212:8000/api/upload' \
--form 'csv=@"/C:/Users/User/Downloads/sample_test_data.csv"'
curl --location 'http://34.46.28.212:8000/api/status/89652507-c97a-43d1-8dd1-03a74e15d473'