stonexer / yab

🐈 A fetch library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo

A simple fetch library.


Introduction

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

Features

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

Browser Support

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

Install

npm

npm install yab-fetch

yarn

yarn add yab-fetch

CDN

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

Useage

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

Documents

See full documents, please read Yab-fetch.

Packages

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

Changelog

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

Contributors

Thanks goes to the wonderful people.

License

MIT

About

🐈 A fetch library


Languages

Language:TypeScript 79.3%Language:JavaScript 20.7%