JULIERAJ / KIDS-FIRST-Back

KIDS FIRST 2024 MVP Backend
0 stars 1 forks source link

Feat/Backend: setup multer for storing media(images) + Cloudinary #52

Open ElenaCherpakova opened 1 month ago

ElenaCherpakova commented 1 month ago

Description: Implement Multer middleware to handle file uploads for storing media, specifically images, in the backend. This will involve configuring Multer, setting up storage options, and integrating the middleware into the existing backend routes.

helpful article

Tasks

  1. Install Multer

    • Add Multer as a dependency in the project.
    • Run npm install multer
  2. Configure Multer

    • Set up Multer configuration for handling image uploads.
    • Define storage options (e.g., destination, filename format).
    • Add file filter to validate image file types (e.g., .jpg, .png).
  3. Create Upload Route

    • Create a new route to handle image uploads.
    • Apply Multer middleware to the route to process incoming files.
  4. Integrate with Existing Routes (Pending Development of Album Feature)

    • Integrate Multer middleware with existing routes that require image uploads. Note: Full integration will be completed once the Album feature is developed.
  5. Handle File Storage

    • Implement logic to handle storing uploaded images in the desired location (e.g., local filesystem, cloud storage).
    • Ensure images are accessible via appropriate URLs.
  6. Error Handling

    • Add error handling for file upload issues (e.g., invalid file type, upload failures).
  7. Testing

    • Test the image upload functionality to ensure files are processed and stored correctly.
    • Verify that error handling works as expected.

Acceptance Criteria:

[] Multer is installed and configured to handle image uploads. [] A new route for image uploads is created and integrated. [] Uploaded images are stored correctly and accessible. [] Error handling for file uploads is implemented. [] Note: Integration with Album feature routes will be pending until the feature is developed.