barbarojs-http
Wrapper of github fetch lib: https://github.com/github/fetch It uses native Promise to chain Middlewares
Installation
npm install barbarojs-http
Usage
;
How To
Lib interpolates variables as described here below Supported verbs are: GET, POST, PUT, PATCH, DELETE
// define params to be interpolatedlet conn = '/test/:id'; // send requestconn; // /test/123?q=1 // postconn; // /test/123 -> body {q:1, name: 'me'}
Special Features
Set development server
;httpProvider;
Set JWT Token
;......// sethttpProvider;// remove httpProvider;
Middlewares
;......// set middleware, always return a promise in order to chain other middlewares // or your promisehttpProvider; // myClass.js......let conn = '/test/:id';conn;......
Options
;......// set custom optionshttpProvider;