1.8.0 • Published 3 years ago

@rexfng/google-sheet-db v1.8.0

Weekly downloads
10
License
ISC
Repository
-
Last release
3 years ago

Google Sheet DB

Description

Google Sheet DB is a library that provides helpers to convert google sheet csv into json, with express routers that serves the data and creates a RESTful api.

Define Environment Variables

Define the follow environment variable. They are all required. | Variable Name | Description | |---------------|-------------| | REDIS_HOST | // sample values: 19324 | | REDIS_PORT | // sample values: redis-19324.c1.us-west-2-2.ec2.cloud.redislabs.com | | REDIS_AUTH_PASS | // sample values: 6X2MOasdfasdfamSY5WCo0 |

Initialize Module

const googleSheetDb = require('@rexfng/google-sheet-db')

Get Sheet Data Helper

const googleSheetDb = require('@rexfng/google-sheet-db')
let googleSheetDbInstance = await googleSheetDb.helpers.getSheetData({sheet, id})

Router Helper

const googleSheetDb = require('@rexfng/google-sheet-db')
let GoogleSheetAPI = googleSheetDb.api

app.use('/', GoogleSheetAPI.getSheetData) // GET 

Get Sheet Data Endpoint

The endpoint takes in JSON Body in the following format http://localhost:3000/{:google-sheet-id} GET

Optional Query

KeyExampleDescription
sheet?sheet=dish_conceptSpecifying which sheet to retrieve data from with in spreadsheet file
unique?unique=dish_conceptList out unique values of a given field

Response Code | CODE| MESSAGE | Details | |-----|----------------------|---| | 200 | SUCCESS | Successfully retrieved data | | 500 | INTERNAL_ERROR | Server side error |

Response

{
	//[JSON]
}

Search Sheet Data Endpoint

The endpoint takes in JSON Body in the following format http://localhost:3000/{:google-sheet-id} GET

Optional Query

KeyExampleDescription
sheet?sheet=dish_conceptSpecifying which sheet to retrieve data from with in spreadsheet file
limit?limit=20pagination size
page?page=1pagination page
q?q=somethingquery for fuzzy search
cached?cached=falsefalse will fetch new data, true or empty will serve from redis
search_terms?search_terms=titlethe title column used for searches, deliminated by "commas" for additional terms

Response Code | CODE| MESSAGE | Details | |-----|----------------------|---| | 200 | SUCCESS | Successfully retrieved data | | 500 | INTERNAL_ERROR | Server side error |

Response

{
	//[JSON]
}
1.8.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago