This repository has been archived by the owner. It is now read-only.
Fetcher for AcyOrt
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.editorconfig
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json
request.js

README.md

acyort-fetcher

Build Status codecov

Fetcher for AcyOrt

Install

$ npm i acyort-fetcher -S

Usage

const Fetcher = require('acyort-fetcher')

const config = {
  user: 'LoeiFy',         // github username
  repository: 'Recordum', // github repository
  order: 'created',       // 'created' or 'updated'
  cache: false,           // if cache json data. create a json file in current path
  base: process.cwd(),    // current path
  token: 'xxxx'           // github access token
}
const fetcher = new Fetcher(config)
const { axios, getGithub } = fetcher

axios(...config)          // axios
getGithub(...config)      // axios width github headers, github token

fetcher.status = status => {
  console.log(status)     // requests information
}

// add custom headers
fetcher.setHeaders({ Accept: 'application/vnd.github.v3.full' })

fetcher.fetch()
  .then(res => console.log(res))    // the json data
  .catch(err => console.log(err))   // error