Yab is a high-level HTTP client based on Fetch API and koa-like
middlewares.
- Middleware: koa-like middleware.
- Fetch: base on browser fetch API.
- TypeScript: Everything in Typescript.
This library can only be used in modern browser environment. Polyfill may be needed.
npm install yab-fetch
yarn add yab-fetch
<script src="https://unpkg.com/yab-fetch.min.js"></script>
Basic Usage
import { createFetch } from "yab-fetch";
const request = createFetch();
request.get("https://example.com");
Middleware Usage
import { createFetch } from "yab-fetch";
import { createCache } from "yab-fetch-cache";
const request = createFetch();
request.use(createCache());
request.get("https://example.com");
See full documents, please read Yab-fetch.
This repository is a monorepo that we manage using Lerna. That means that we actually publish several packages to npm from the same codebase, including:
Package | Version | Description |
---|---|---|
yab-fetch |
The fetch library. | |
yab-fetch-cache |
A yab middleware, focus on cache response using IndexDB. |
Detailed changes for each release are documented in CHANGELOG.md.
Thanks goes to the wonderful people.