0.0.25 • Published 5 years ago

gitorm v0.0.25

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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}`
})
0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.2

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago