js-api-wrapper

0.0.9 • Public • Published

js-api-wrapper

An API wrapper that can easily export helpful api functions.

Getting started

install the js-api-wrapper

npm install js-api-wrapper

then export apis with the function wrap in a module

import {wrap} from 'js-api-wrapper';

const defConfig = {}

const sufConfigs = {
    Sync: {async: false},
    WithoutCache: {cache: false},
}

export default wrap({defConfig, sufConfigs});

then import the module, the wrapped function returns a Promise object.Example is shown as follows, where XXX is the name of the new module

import * as ApiUtils from XXX;

ApiUtils.jsonGETSync('http://example.com')

Readme

Keywords

Package Sidebar

Install

npm i js-api-wrapper

Weekly Downloads

1

Version

0.0.9

License

MIT

Unpacked Size

42.8 kB

Total Files

14

Last publish

Collaborators

  • j1031