Skip to content

jagraj-singh/GoogleDriveExtended

Repository files navigation

Google Drive API Interaction using NodeJs

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.

Prerequisites

Before getting started, make sure you have the following installed on your machine:

Getting Started

  1. Clone this repository to your local machine:

    git clone https://github.com/jagraj-singh/GoogleDriveExtended.git
    cd GoogleDriveExtended
  2. 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]
  3. Obtain your service accounts crentials and create a serviceAccountKey.json file (https://www.labnol.org/google-api-service-account-220404)

  4. 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.

  5. Access your Node.js application at http://localhost:3000.

Application Structure

  • 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.

Test the App

  1. 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

  1. To check download/upload status
curl --location 'http://localhost:8080/v1/status?requestId={{request_id}}8&operation=download'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published