0.1.2 • Published 4 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 obten
import 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
GET
request:
obten
.get({
url: '',
})
.then((data) => console.log(data));
note: url
is a required parameter.
- Making a
POST
request
obten
.post({
url: '',
body: {},
})
.then((data) => console.log(data));
note: url
and body
are the required parameters.
- Making a
PUT
request:
obten
.put({
url: '',
body: {},
})
.then((data) => console.log(data));
note: url
and body
are the required parameters.
- Making a
DELETE
request
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.