1.0.5 • Published 6 years ago
acyort-fetcher v1.0.5
acyort-fetcher
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