Skip to content
This repository has been archived by the owner on Dec 4, 2021. It is now read-only.
/ gitorm Public archive

🎩 A simple ORM to use your Github Repositories as a Database and a Data Bucket with Node.js

License

Notifications You must be signed in to change notification settings

gbkel/gitorm

Repository files navigation

gitorm

npm version install size npm downloads CircleCI

A simple ORM to use your Github Repositories as a Database and a Data Bucket with Node.js

Features

  • Make CRUD requests on files of your Github Repository
  • Use your Github Repository as a Data Bucket

Installing

$ npm install gitorm

Getting started

gitorm(config)

To use Gitorm, you'll need to generate a token with repo and user scopes on Github Developer Settings.

// Creating a connection
import gitorm from 'gitorm'

const Gitorm = new gitorm({
	token: 'generated-token',
	repository: 'repo-name',
	owner: 'repo-owner'
})

await Gitorm.connect()
console.log(Gitorm.status)

gitorm.find(options)

// Finding a file
const fileName = 'index.txt'
const file = await Gitorm.find({
	path: `src/${fileName}`
})

gitorm.findAll(options)

// Finding all files on a directory
const file = await Gitorm.findAll({
	path: 'src/'
})

gitorm.create(options)

// Creating a file
const fileName = 'index.json'
const fileData = { test: 123 }
const file = await Gitorm.create({
	data: JSON.stringify(fileData),
	path: `src/${fileName}`
})

gitorm.update(options)

// Updating a file
const fileName = 'index.json'
const updatedData = { test: 123 }
const updatedFile = await Gitorm.update({
	data: JSON.stringify(updatedData),
	path: `src/${fileName}`
})

gitorm.delete(options)

// Deleting a file
const fileName = 'index.json'
const file = await Gitorm.delete({
	path: `src/${fileName}`
})

About

🎩 A simple ORM to use your Github Repositories as a Database and a Data Bucket with Node.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published