Callarest
A simple tool to natively make http(s) requests in node
Example Usage
Verbose
const callarest = require('callarest')
callarest({
method: 'post',
body: JSON.stringify({ hello: 'world' }),
headers: {
'Content-Type': 'application/json'
},
url: 'https://www.example.com'
}, function (error, rest) {
if (error) {
console.log('There was an error:', error);
}
console.log('The request was:', rest.request);
console.log('The response was:', rest.response);
console.log('The body was:', rest.body);
})
JSON
const callarestJson = require('callarest/json)
callarestJson({
method: 'post',
body: { hello: 'world' },
url: 'https:
}, function (error, rest) {
if (error) {
console.log('There was an error:', error);
}
console.log('The request was:', rest.request);
console.log('The response was:', rest.response);
console.log('The body was:', rest.body);
})
License
This project is licensed under the terms of the MIT license.