Skip to content

mjolnirjs/yab

Folders and files

NameName
Last commit message
Last commit date
Jul 28, 2019
Jul 28, 2019
Nov 21, 2019
Jul 28, 2019
Aug 27, 2019
Aug 27, 2019
Aug 10, 2019
Aug 10, 2019
Aug 18, 2019
Aug 27, 2019
Aug 10, 2019
Aug 27, 2019
Aug 18, 2019
Aug 19, 2019
Mar 18, 2020
Aug 10, 2019
Aug 18, 2019
May 8, 2020
Aug 26, 2019
Aug 10, 2019
Aug 10, 2019
May 8, 2020

Repository files navigation

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