Yab is a high-level HTTP client based on Fetch API and koa-like
middlewares.
- Middleware: koa-like middleware.
- Fetch: based on browser fetch API.
- TypeScript: Everything in Typescript.
This library can only be used in modern browser environments. Polyfill may be needed.
npm install yab-fetch
yarn add yab-fetch
<script src="https://unpkg.com/yab-fetch/dist/yab-fetch.min.js"></script>
Basic Usage
import { createYab } from "yab-fetch";
const yab = createYab();
yab.get("https://example.com");
yab.post("https://example.com");
Middleware Usage
import { createYab } from "yab-fetch";
import { createCache } from "yab-fetch-cache";
const yab = createYab();
yab.use(createCache());
yab.get("https://example.com");
See full documents, please read yab-fetch.
This repository is a mono-repo that we manage using Lerna. This means 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. | |
yab-fetch-logger |
A yab middleware, logger yab/response of fetch action |
Detailed changes for each release are documented in CHANGELOG.md.
Thanks go to the wonderful people.