autofetch

4.1.0 • Public • Published

autoFetch

npm

fetch api with customer auto pre actions

Installation

$ npm install autoFetch

Why Not isomorphic-fetch

  • More api for node env
    • Headers.keys
    • Headers.values
  • global baseHost,callback,headers,queries and url params

Usage

require('autoFetch');
 
fetch.baseHost('http://domain.com');
 
fetch('//path'); // http://domain.com/path;
 
fetch.baseHost((url)=>{
  return url += '/path';
})
 
fetch('//path'); // http://domain.com/path;
 
fetch('//user/:id',{ params: { id: 123 } }); // http://domain.com/user/123
 
fetch.callback((response)=>{
  console.log(response);
  return response;
});

Contribution

PR and issue welcome

Readme

Keywords

Package Sidebar

Install

npm i autofetch

Weekly Downloads

2

Version

4.1.0

License

MIT

Last publish

Collaborators

  • yeliex