1.0.0 • Published 5 years ago
oib2b-map3c-http v1.0.0
OIB2B MAP3C HTTP
OIB2B MAP3C HTTP is a NodeJs library for http requests into the MP3C legacy API.
Installation
Use the package manager npm or yarn to install.
npm i --save oib2b-map3c-http
or
yarn add oib2b-map3c-http
Usage
const Map3c = require('oib2b-map3c-http');
const map3c = new Map3c({ uri: 'MAP3C_URI', acessToken: 'ACCESS_TOKEN' });
//GET
map3c
.get('MAP3C_ROUTE')
.then(res => console.log(res))
.catch(err => console.log(err));
//POST
map3c
.post('MAP3C_ROUTE', { body: { foo: 'bar' } })
.then(res => console.log(res))
.catch(err => console.log(err));
//PUT
map3c
.put('MAP3C_ROUTE', { body: { foo: 'bar' } })
.then(res => console.log(res))
.catch(err => console.log(err));
//PATHC
map3c
.patch('MAP3C_ROUTE', { body: { foo: 'bar' } })
.then(res => console.log(res))
.catch(err => console.log(err));
//DELETE
map3c
.delete('MAP3C_ROUTE')
.then(res => console.log(res))
.catch(err => console.log(err));
//You can add custom headers to any request adding the header property to the option parameter
//Like this:
map3c.get('MAP3C_ROUTE', { headers: { foo: 'bar' } });
Authors
See also the list of contributors who participated in this project.
License
1.0.0
5 years ago