This project is a summary of this back-end trimester: authentication, NodeJS, MongoDB, Redis, pagination and background processing.
This project is a comprehensive back-end solution for a file management service, covering authentication, NodeJS, MongoDB, Redis, pagination, and background processing.
The goal is to build a robust platform for uploading and viewing files with a focus on simplicity and learning.
- User Authentication via Token: Secure your platform with user authentication using tokens.
- List All Files: Display a comprehensive list of all files available in the system.
- Upload a New File: Allow users to upload new files easily.
- Change Permission of a File: Grant users the ability to modify file permissions.
- View a File: Provide users with the capability to view files directly within the platform.
- Generate Thumbnails for Images: Automatically generate thumbnails for image files.
Make sure you have the following tools installed:
- Node (version 12.x.x)
- MongoDB
- Redis
-
Clone the repository:
git clone https://github.com/steve2700/alx-files_manager.git cd alx-files_manager
-
npm install
npm start
## Project Structure
The project is organized into various components and functionalities:
-**Authentication**: Token-based authentication for securing user access.
-**MongoDB**: Integration for persistent storage of user data and files.
-**Redis**: Utilized for temporary data storage and caching.
-**Background Processing with Bull**: Asynchronous task handling for operations like thumbnail generation.
**File Operations**: Efficiently managing file-related operations.
Usage
Authentication
The platform utilizes token-based authentication. Users need to obtain a token for accessing protected routes. Include the token in the request headers.
## MongoDB
User and file data are stored in MongoDB. MongoDB models and schemas ensure proper data organization.
## Redis
Temporary data is stored in Redis. Redis serves as a fast and efficient solution for caching and temporary storage.
### Background Processing
Bull is employed for background processing. It manages tasks asynchronously, providing efficiency in operations such as generating thumbnails for images.
File Operations
List All Files:
## Endpoint: /api/files
Method: GET
Upload a New File:
## Endpoint: /api/files/upload
Method: POST
Change Permission of a File:
## Endpoint: /api/files/:id/permissions
Method: PUT
View a File:
## Endpoint: /api/files/:id
Method: GET
Testing
Ensure your code adheres to best practices and is consistently styled by running:
```bash
npm test