Skip to content

SlavyanDesu/TempStorage

Repository files navigation

TempStorage

CodeFactor GitHub repo size GitHub License Website
This project is a web application that allows users to upload and delete media files (images and videos). It leverages Cloudinary for media storage and processing, providing features like file transformations and optimizations.

Table of Contents

Installation

  1. Clone the repository:
git clone https://github.com/SlavyanDesu/TempStorage.git
  1. Navigate to the project directory:
cd TempStorage
  1. Install the depedencies:
npm install
  1. Set up environment variables:
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"
SESSION_SECRET="put-any-secret-code-you-like"
PORT=3000
DATABASE_URL="postgresql://your-neondb:[email protected]/dbname?sslmode=require"
  1. Build application:
npm run build

Usage

To start the application, run:

npm start

Visit http://localhost:3000 in your browser to access the application.

Features

  • File upload and management
  • Image and video transformations
  • Cookie-based validation for image deletion, ensuring that only the owner of an uploaded image can delete it
  • Responsive design for mobile and desktop

Technologies Used

  • Node.js
  • Express.js
  • Cloudinary
  • Prisma
  • Neon
  • TypeScript
  • EJS
  • HTML/CSS/JavaScript

API Documentation

Upload Endpoint

  • POST /upload
  • Request Body: Form data containing the file to upload.
  • Response: URL of the uploaded file.

Delete Endpoint

  • DELETE /delete/:publicId
  • Parameters: publicId of the file to delete.
  • Response: Success message.

Files Endpoint

  • GET /files
  • Response: Renders a page displaying uploaded files, including thumbnails and download links.

License

This project is licensed under the MIT License. See the LICENSE file for details.