This repository contains a simple Node.js application that interacts with Redis using Docker Compose. The Docker Compose configuration includes separate services for the Node.js application and Redis, allowing them to communicate within the same Docker network.
Before getting started, make sure you have the following installed on your machine:
- Docker: Install Docker
- Docker Compose: Install Docker Compose
-
Clone this repository to your local machine:
git clone https://github.com/jagraj-singh/GoogleDriveExtended.git cd GoogleDriveExtended
-
Create a .env file with following contents
PORT=8080 REDIS_PORT=6379 REDIS_HOST=redis LOG_LEVEL=debug PARENTID=xxxxx [parent folder id where file needs to be uploaded in google drive]
-
Obtain your service accounts crentials and create a serviceAccountKey.json file (https://www.labnol.org/google-api-service-account-220404)
-
Build and run the Docker containers using Docker Compose:
docker-compose up -d
This command will build the Docker images and start the containers in detached mode.
-
Access your Node.js application at http://localhost:3000.
- src: This directory contains source code.
- api-specs - This directory contains api-specs for the application
- main.js: Main entry point for the Node.js application.
- Dockerfile: Dockerfile for building the Node.js application image.
- docker-compose.yml: Docker Compose configuration file defining services for the Node.js app and Redis.
- package.json and package-lock.json: Node.js application dependencies.
- To start download and upload procedure
curl --location 'http://localhost:8080/v1/download-and-copy' \
--header 'Content-Type: application/json' \
--data '{
"fileId" : "{{your_file_id}}"
}'
This will return a requestId which can be used futher to check status of upload or download
- To check download/upload status
curl --location 'http://localhost:8080/v1/status?requestId={{request_id}}8&operation=download'