Apps Script DB
A module to prodive a simple key-value based database by Google Apps Script
Get Database Url
- Go to https://script.google.com/home
- Create a script with content of
db.js
file and save with any project name you wants - Click "Publish" -> "Deploy as web app..."
- Set "Who has access to the app:" to "Anyone, even anonymous"
- Click "Deploy" and get the url
Usage
npm i --save apps-script-db
const ADB = require('apps-script-db')
const db = new ADB(process.env.ADB_URL)
(async ()=>{
await db.set('key',{a: 5})
await db.get('key')
})()
API
db.set(key: string,value: any)
Set the value of key
to value
db.get(key: string)
Get the value of key
if key==='*', it will return an object of all values
db.del(key: string)
Delete the value of key
if key==='*', it will delete every things