Skip to content

Simple Product API's with Google Drive API to store/fetch all the assets in/from Google Drive

Notifications You must be signed in to change notification settings

prashant-cn/google-drive-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-drive-storage

Simple Product API's with Google Drive API to store/fetch all the assets in/from Google Drive.

This is a simple API for people to practice E-Commerce like functionality, especially for UX and Mobile developers to insert, fetch and fetch single product by ID. For Backend Developers to see the working of an API along with the working of Google Drive API for storage using NodeJS.

Prerequisites to run the app in local environment

  1. Installed NodeJS
  2. Installed MongoDB along with a MongoDB GUI, I'm using Robo 3T.

Step 1: Follow steps from Google Drive API for NodeJS, URL: https://developers.google.com/drive/api/v3/quickstart/nodejs

Step 2: Get a "credentials.json" by clicking on "Enable the Drive API".

Step 3: Put the "credentials.json" file inside "src/auth" folder.

Step 4: Create a "config" folder in parallel to "src" folder, then a "dev.env" file insde the "config" folder with MongoDB URL. Example: MONGO_DB_PATH=mongodb://127.0.0.1:27017/products-api

Step 5: Run the app in local environment and follow the steps shown in terminal window to genrate "token.json".

Step 6: Change the "parents" ID inside "src/utils/driveFunctions.js" with your own folder ID from google drive or simply comment out the "parents" property to store the files in you root of google drive.

Congratulations! You are good to GO now.

If anyone wants to directly use the API for practice purpose, then head over to below URL along with the mentioned parameters

  1. Insert a Product
    URL: http://prashant-cn-google-drive-api.herokuapp.com/upload
    Params: image, name, price, description
    Method: POST

  2. Fetch all products
    URL: http://prashant-cn-google-drive-api.herokuapp.com/products
    Params: None
    Method: GET

  3. Fetch single product by ID
    URL: http://prashant-cn-google-drive-api.herokuapp.com/product/:id
    Params: replace ":id" with the "_id" from 2nd API route.
    Method: GET

Ping me at https://www.linkedin.com/in/prashant-kumar-2124b3b4/ if any of you have any questions, suggestions, feedback or just want to say Hi:)

About

Simple Product API's with Google Drive API to store/fetch all the assets in/from Google Drive

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages