Skip to content

Latest commit

 

History

History
98 lines (60 loc) · 3.23 KB

README.md

File metadata and controls

98 lines (60 loc) · 3.23 KB

logo

A simple fetch library.

npm

Introduction

Yab is a high-level HTTP client based on Fetch API and koa-like middlewares.

Features

  • Middleware: koa-like middleware.
  • Fetch: based on browser fetch API.
  • TypeScript: Everything in Typescript.

Browser Support

This library can only be used in modern browser environments. Polyfill may be needed.

Install

npm

npm install yab-fetch

yarn

yarn add yab-fetch

CDN

<script src="https://unpkg.com/yab-fetch/dist/yab-fetch.min.js"></script>

Usage

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");

Documents

See full documents, please read yab-fetch.

Packages

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 npm The fetch library.
yab-fetch-cache npm A yab middleware, focus on cache response using IndexDB.
yab-fetch-logger npm A yab middleware, logger yab/response of fetch action

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

Contributors

Thanks go to the wonderful people.

License

MIT