This repository is a Node.js application that integrates Express.js, Multer, and Cloudinary for handling file uploads.
- Upload files using Multer middleware
- Store files on Cloudinary
- Retrieve Cloudinary URLs for uploaded files
-
Clone the Repository:
git clone https://github.com/cedriccastro99/express-multer-cloudinary.git
-
Navigate to the Project Directory:
cd express-multer-cloudinary -
Install Dependencies:
npm install
-
Set Up Environment Variables: Create a
.envfile in the root directory and add your Cloudinary credentials:CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret
Replace
your_cloud_name,your_api_key, andyour_api_secretwith your actual Cloudinary credentials.
-
Start the Server:
npm start
The server will start, and you can access it at
http://localhost:5000. -
Upload a File: Send a
POSTrequest to/api/files/uploador<your own endpoint>with the file in theform-dataunder the keyfile. -
Response: The server will respond with the Cloudinary URL of the uploaded file.
This project is open-source and available under the MIT License.