# cover-axios

> 基于axios的二次封装, 支持TS

Latest version **1.0.1** (published 2023-04-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install cover-axios
pnpm add cover-axios
yarn add cover-axios
bun add cover-axios
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-04-13 |
| First published | 2021-07-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 12 |
| Author | Bell |
| Maintainers | bell2020 |
| Keywords | xhr, http, ajax, promise, node |

## Links

- npm: https://www.npmjs.com/package/cover-axios
- Repository: https://github.com/Bell-1/cover-axios
- Homepage: https://github.com/Bell-1/cover-axios#readme
- Issues: https://github.com/Bell-1/cover-axios/issues
- npm.io page: https://npm.io/package/cover-axios

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-04-13
- 1.0.0 — 2023-03-29
- 0.3.10 — 2023-01-11
- 0.3.9 — 2023-01-05
- 0.3.8 — 2022-11-04
- 0.3.7 — 2022-05-09
- 0.3.6 — 2022-05-07
- 0.3.5 — 2022-05-07
- 0.3.4 — 2022-05-07
- 0.3.3 — 2022-03-02
- 0.3.2 — 2022-03-01
- 0.3.1 — 2022-03-01
- 0.3.0 — 2022-03-01
- 0.2.6 — 2022-03-01
- 0.2.5 — 2021-09-26
- … 34 more at https://npm.io/package/cover-axios/versions

## README

# cover-axios

基于 axios 进行二次封装, 支持 TS

## Install

Using npm:

```bash
$ npm i cover-axios
```

Using yarn:

```bash
$ yarn add cover-axios
```
Using pnpm:

```bash
$ pnpm i cover-axios
```

## Example

```js
import http, { genApi, addApi, addApiList, request } from 'cover-axios'

const api = genApi('login', 'api/user/login', 'POST')

http.addApi(api)
// or
http.addApiList([api])

const res = await http.request('login', { user: 'user1', password: 123456 })
const res = await request('login', { user: 'user1', password: 123456 })
```

## cover-axios API

Requests can be made by passing the relevant config to axios.

### interceptors 拦截器

延用 axios 的拦截器

```js
http.interceptors.request.use(requestIntercept, requestFail)
http.interceptors.response.use(responentIntercept, requestFail)
```

---
_Source: https://npm.io/package/cover-axios · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
