3.0.0 • Published 5 years ago

apisdk v3.0.0

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

API SDK

Usage

const api = new API(root, globalConfig);

api.PATH⁰..PATHⁿ.method(currentConfig);
  • root is the root path of api, default '/'
  • globalConfig is global config for all invokes
  • currentConfig is current config for current invoke
  • PATH⁰..PATHⁿ is request path of api
  • method is one of HTTP methods

  • config is the parameter of fetch api
  • config.credentials is defaultly 'include'

Examples

import API from 'apisdk';

const api = new API('http://127.0.0.1');

/* GET http://127.0.0.1/path1/path2 */
let $result = api.path1.path2.get();
import API from 'apisdk';

const api = new API();

/* POST /path1/path2 HTTP/1.1 */
let $result = api.path1.path2.post({ body: 'a=1&b=2' });
3.0.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.4

7 years ago

2.0.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

0.1.0

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago