acyort-fetcher

Fetcher for AcyOrt

Usage no npm install needed!

<script type="module">
  import acyortFetcher from 'https://cdn.skypack.dev/acyort-fetcher';
</script>

README

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