https://github.com/dvcol/base-http-client
Generic http client with caching and cancel support
https://github.com/dvcol/base-http-client
abstract client fetch http library
Last synced: over 1 year ago
JSON representation
Generic http client with caching and cancel support
- Host: GitHub
- URL: https://github.com/dvcol/base-http-client
- Owner: dvcol
- License: mit
- Created: 2024-05-11T16:12:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T16:36:27.000Z (almost 2 years ago)
- Last Synced: 2024-10-24T22:17:37.617Z (over 1 year ago)
- Topics: abstract, client, fetch, http, library
- Language: TypeScript
- Homepage:
- Size: 529 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
@dvcol/base-http-client
> Simple HTTP client wrapping fetch API to add basic caching, abort signal and proxy support.
## Prerequisites
- pnpm >=9.0.0
- node >=20.0.0
## Install
```sh
pnpm install
```
## Usage
```sh
pnpm add @dvcol/base-http-client
```
### Features
* [Modular endpoint typing](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L20-L138) (both request and response)
* [Built-in cache support](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L235-L484) (per client, endpoint, or query)
* [Extensible cache store](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L186-L194) (in-memory, local storage, etc.)
* [Event observer](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L486-L575) (request, query, auth)
* [Built-in cancellation support](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L691-L758)
* [Built-in cors proxy support](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/models/base-client.model.ts#L14)
## Author
* Github: [@dvcol](https://github.com/dvcol)
## 📝 License
This project is [MIT](https://github.com/dvcol/trakt-extension/blob/master/LICENSE) licensed.