Bivrost
Bivrost allows to organize a simple interface to asynchronous APIs.
Fetch API Call
Easiet way to use fetch with interceptros and awesome api endpoint declaration. bivrost/packages/fetch-api-call
Bivrost
The main idea of Bivrost is grouping several API methods into data-sources.
Bivrost full documentation and recipes
Installation
yarn add bivrost
The gist
That’s it! Create api function for github api.
; const githubApi = ; //define API methodconst repositoryList = //call API method ;
Create data source that contain few github api methods (get repositories list and get repository info) and its invoke chain.
;;; // define invoke method chain. Default chain is - ['api', 'process'] static steps = 'api' 'immutable'; // "define "api" step static api = repos: repoInfo: ; // step function will be executed for each method static Immutable; // define data source public methods that invokes steps methods { return this; } { return this; }
Extends GihtubRepositories and define username. Now all requests will be done for facebook's github group.
; const FACEBOOK_GITHUB_ACCOUNT = 'facebook'; { return super; } { return super; }
Contributing
Project is open for new ideas and features:
- new adapters
- new api functions
- data source features
- feedback is very matter