10x Database
npm install github-commits-databasebash
npm install github-commits-database
`
Usage
First create a new database by running this code:
`js
;(async () => {
const GitCommitDB = require("github-commits-database")
const db = new GitCommitDB()
const uuid = await db.createDatabase()
console.log(uuid) // outputs some uuid.
})()
`
Save the uuid outputted in the console to a .env file. Then you can use the database like below:
`js
const GitCommitDB = require("github-commits-database")
const db = new GitCommitDB()
const uuid = process.env.DATABASE_KEY // change if your generated uuid for your database is on a different process.env path.
async function main() {
// Save data to database
await db.save(uuid, {
user: "John Doe",
project: "john doe's project",
status: "starts"
})
// Retrieve the current state
const data = await db.get(uuid)
console.log("Current Data:", data)
}
main()
`
How It Works
When you call save()`, github-commits-database uses the GitHub API to: