@hellosirandy/rest-api-wrapper
2.0.2 • Public • Published
@hellosirandy/rest-api-wrapper
![npm](https://camo.githubusercontent.com/a5468528d6b922353017a5e944e0bd938df2fbce70eca34fe8e529087209fd07/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f4068656c6c6f736972616e64792f726573742d6170692d777261707065722e737667)
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)
- 2.0.2
0
Version History
Package Sidebar
Install
npm i @hellosirandy/rest-api-wrapper
Weekly Downloads