0.4.0 • Published 10 years ago

stackable-fetcher v0.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

stackable-fetcher

A middleware-based HTTP client library based on node-fetch.

Install

npm install stackable-fetcher

Usage

stackable-fetcher provides Fetcher class. This class has #get, #post, #delete and other HTTP methods that return Promise.

import Fetcher from 'stackable-fetcher'

const fetcher = new Fetcher();
fetcher.get('https://github.com/').then(({ body, headers, status  }) => {
  console.log(body);
});

Middleware

stackable-fetcher is easily extended via middleware stack.

Specs

  • A middleware is a constructor function that takes an application and options
  • A middleware instance has #call(request) property that returns a promise

Example middlewares

Example usage

import { Fetcher, RequestLogger, ResponseLogger } from 'stackable-fetcher'

new Fetcher()
  .use(RequestLogger)
  .use(ResponseLogger)
  .get('https://api.github.com/users/r7kamura');
0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago