This project, alx-files_manager, aims to create a simple platform for uploading and viewing files. The project encompasses various back-end technologies and concepts, including Node.js, Express.js, MongoDB, Redis, and more. It is designed to consolidate knowledge of authentication, data storage, background processing, and API development.
By the end of this project, should be able to:
- Create an API with Express.
- Authenticate users.
- Store data in MongoDB.
- Manage temporary data in Redis.
- Set up and use background workers.
- Node.js
- Express.js
- MongoDB
- Redis
- Kue (for background jobs)
- ES6
- utils/: Contains utility classes and methods.
- routes/: Defines the API endpoints.
- controllers/: Contains the logic for handling API requests.
-
Clone the Repository:
git clone https://github.com/waltertaya/alx-files_manager.git cd alx-files_manager
-
Install Dependencies:
npm install
-
Environment Variables: Set up the following environment variables:
DB_HOST
: MongoDB host (default:localhost
)DB_PORT
: MongoDB port (default:27017
)DB_DATABASE
: Database name (default:files_manager
)REDIS_HOST
: Redis hostREDIS_PORT
: Redis portFOLDER_PATH
: Directory to store uploaded files (default:/tmp/files_manager
)
-
Running the Server: Start the server with the following command:
npm run start-server
The server will run on the port specified by the
PORT
environment variable, or default to port 5000.
-
User Authentication:
- Token-based authentication for secure API access.
- Endpoints to connect, disconnect, and fetch user details.
-
File Management:
- Upload and manage files.
- Generate and manage thumbnails for images.
- Set permissions for files (public/private).
-
Data Handling:
- Use MongoDB for persistent storage of user and file data.
- Use Redis for caching and session management.
-
Background Processing:
- Use Kue to manage background jobs, such as generating thumbnails.
- GET /status: Check the status of Redis and MongoDB.
- GET /stats: Retrieve the number of users and files.
- POST /users: Create a new user.
- POST /files: Upload a new file.
- GET /connect: Authenticate a user.
- GET /disconnect: Sign out a user.
- GET /users/me: Retrieve the current user's information.
- Editors:
vi
,vim
,emacs
,Visual Studio Code
- Node.js version: 12.x.x
- ESLint for code linting
- package.json: Project dependencies and scripts.
- .eslintrc.js: ESLint configuration.
- babel.config.js: Babel configuration.
Please ensure that all implemented functionalities are thoroughly tested and reviewed. Manual QA review is required upon project completion. The auto review will be triggered at the project deadline.