This is a mini backend project that demonstrates how to upload files, such as photos and videos, to Cloudinary. The project is built using Node.js, Express.js, and MongoDB, with Cloudinary as the cloud storage provider.
- File upload functionality (photos and videos)
- Integration with Cloudinary for file storage
- RESTful API for handling file uploads
- MongoDB for managing uploaded file metadata
- Node.js - Server-side JavaScript runtime
- Express.js - Web framework for building the backend
- MongoDB - NoSQL database for storing metadata of uploaded files
- Cloudinary - Cloud storage service for handling file uploads
-
Clone the repository:
git clone https://github.com/rishika105/file-upload-express.git
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your MongoDB URI and Cloudinary credentials:MONGODB_URL=your-mongodb-uri CLOUD_NAME=your-cloudinary-cloud-name API_KEY=your-cloudinary-api-key API_SECRET=your-cloudinary-api-secret PORT= 4000
-
Run the application:
npm start
- POST /localFileUpload - Upload a file to Cloudinary and store its metadata in MongoDB.
- POST /imageUpload - Upload a image to Cloudinary and store its metadata in MongoDB.
- POST /videoUpload - Upload a video to Cloudinary and store its metadata in MongoDB.
- POST /imageSizeReducer - Reduce a image size already stored in cloudinary.