chainr-proxy-axios
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta • Public • Published

chainr-axios

Combination of axios and chainr to make http requests.

import { createAxios } from 'chainr-proxy-axios'
 
const instance = createAxios({
  baseURL: 'http://example.com/api',
  rules: [
    { match: /^(insert|update)/, method: 'post' }
  ]
})
 
// GET http://example.com/api/getUsers
instance.getUsers()
 
// POST http://example.com/api/updateUser
// with data { id: 0, name: 'hjkcai' }
instance.updateUser({ id: 0, name: 'hjkcai' })
 
// POST http://example.com/api/insertUser
// Authorization: xxx
instance.insertUser({ name: 'shirley' }, {
  headers: { Authorization: 'xxx' }
})

API

coming soon...

Package Sidebar

Install

npm i chainr-proxy-axios

Weekly Downloads

2

Version

1.0.0-beta

License

MIT

Unpacked Size

11.1 kB

Total Files

7

Last publish

Collaborators

  • hjkcai