Skip to content

About

Axios singleton instance for node and browserify projects

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

Axios Singleton Instance

Axios Singleton Instance for Node and Browserify projects

Quick start

import axios from 'axios-singleton'

const axiosInstance: any = axios
const result = await axiosInstance.get('https://api.github.com/users/Quynh-Nguyen')

...

If you want to customize headers

import axios from 'axios-singleton'

const axiosInstance: any = axios
axiosInstance.setConfigure({
  baseURL: 'https://api.github.com',
  headers: {
    common: {
      'Content-Type': 'application/json'
    }
  }
})

const result = await axiosInstance.get('/users/Quynh-Nguyen')

...

If you want to set Bearer token to headers

import axios from 'axios-singleton'

const axiosInstance: any = axios
axiosInstance.setHeaderToken('YOUR_TOKEN')

...

About

Axios singleton instance for node and browserify projects

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages