Use Github as a mini-database
npm i @movingcastle/dbhub
test.ts
import { DBhub } from "@movingcastle/dbhub";
let db = new DBhub({
authToken: 'xxxxxx', //your github token
dbs: [ //dbbase name or path
"test"
],
owner: "xxx", //your github name
repo: "xxx" //your github repo name
})
db.connect(() => {
//change some data
db.setData('test', 'testabc', { num: 123456 })
//sync this github db
db.sync(()=>{
console.log('finish')
});
})
just create a file named xxx.raw
delete the file on github.com
Dont make the file too large, it will cause some problems