@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)

Package Sidebar

Install

npm i @hellosirandy/rest-api-wrapper

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

11.8 kB

Total Files

6

Last publish

Collaborators

  • hellosirandy