This project is a summary of this back-end trimester: authentication, NodeJS, MongoDB, Redis, pagination and background processing.
- User authentication via a token
- List all files
- Upload a new file
- Change permission of a file
- View a file
- Generate thumbnails for images
- create an API with Express
- authenticate a user
- store data in MongoDB
- store temporary data in Redis
- setup and use a background worker
- A Google API is created with at least an email sending scope and a valid URL (e.g.;
http://localhost:5000/
) should be one of the redirect URIs. Thecredentials.json
file is stored in the root directory of this project.
The required environment variables should be stored in a file named .env
and each line should have the format Name=Value
. The table below lists the environment variables that will be used by this server:
Name | Required | Description |
---|---|---|
GOOGLE_MAIL_SENDER | Yes | The email address of the account responsible for sending emails to users. |
PORT | No (Default: 5000 ) |
The port the server should listen at. |
DB_HOST | No (Default: localhost ) |
The database host. |
DB_PORT | No (Default: 27017 ) |
The database port. |
DB_DATABASE | No (Default: files_manager ) |
The database name. |
FOLDER_PATH | No (Default: /tmp/files_manager (Linux, Mac OS X) & %TEMP%/files_manager (Windows)) |
The local folder where files are saved. |
- Clone this repository and switch to the cloned repository's directory.
- Install the packages using
yarn install
ornpm install
.
Start the Redis and MongoDB services on your system and run yarn start-server
or npm run start-server
.
- Create a separate
.env
file for the tests named.env.test
and store the value of the environment variables for the testing event in it. - Run
yarn test
ornpm run test
to execute the E2E tests.
- TODO: Generate OpenAPI documentation with apidoc.