@hellosirandy/rest-api-wrapper

2.0.2 • Public • Published

@hellosirandy/rest-api-wrapper

npm

Install

$ npm install @hellosirandy/rest-api-wrapper

Usage

Initialize

import API from '@hellosirandy/rest-api-wrapper';

const baseURL = 'https://example.com';
const api = API(baseURL);

Get

const options = {
  endpoint: '/test',
  token: '123456-asdf', //option
  params: {
    foo: 'bar'
  } //option
}
api.get(options)

Post

const options = {
  endpoint: '/test',
  token: '123456-asdf', //option
  body: {
    foo: 'bar'
  } //option
}
api.post(options)

Put

const options = {
  endpoint: '/test',
  token: '123456-asdf', //option
  body: {
    foo: 'bar'
  } //option
}
api.put(options)

Delete

const options = {
  endpoint: '/test',
  token: '123456-asdf', //option
}
api.delete(options)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.21latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.21
2.0.10
1.7.10
1.6.00
1.5.00
1.4.10
1.5.10
1.4.00
1.3.00
3.2.10
3.2.00
3.1.10
3.1.00
3.0.00
2.1.00
2.0.00
1.2.00
1.1.00
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @hellosirandy/rest-api-wrapper

Weekly Downloads

1

Version

2.0.2

License

MIT

Unpacked Size

11.8 kB

Total Files

6

Last publish

Collaborators

  • hellosirandy