0.1.2 • Published 5 years ago
obten v0.1.2
obten
A fetch based minimal HTTP client for JavaScript Applications running in the web browser.
Usage
Install obten in your node application
npm install --save obtenimport obten
import obten from 'obten';obten uses a configuration object for any of it's methods. See below how to use it in your applications.
- Making a
GETrequest:
obten
.get({
url: '',
})
.then((data) => console.log(data));note: url is a required parameter.
- Making a
POSTrequest
obten
.post({
url: '',
body: {},
})
.then((data) => console.log(data));note: url and body are the required parameters.
- Making a
PUTrequest:
obten
.put({
url: '',
body: {},
})
.then((data) => console.log(data));note: url and body are the required parameters.
- Making a
DELETErequest
obten
.delete({
url: '',
})
.then((data) => console.log(data));note: url is a required parameter.
You can optionally pass a headers object with your headers in the standard format
obten.method({
headers: {
'header-name': 'value',
},
});note: method can be any of the one mentioned above.