Minimalist HTTP
client for GET
and POST
ing JSON
payloads
- Zero dependencies: perfect for AWS Lambda or Browserify
- Sane default: assumes buffered JSON responses
- System symmetry: Node style errback API
npm i tiny-json-http --save
tiny.get(options, callback)
tiny.post(options, callback)
tiny.put(options, callback)
tiny.del(options, callback)
url
requireddata
form vars fortiny.post
,tiny.put
, andtiny.delete
otherwise querystring vars fortiny.get
headers
key/value map used for headers
err
a real javascriptError
if there was onedata
an object withheaders
andbody
keys
var tiny = require('tiny-json-http')
var url = 'http://www.randomkittengenerator.com'
tiny.get({url}, function __got(err, result) {
if (err) {
console.log('ruh roh!', err)
}
else {
console.log(result)
}
})
Check out the tests for more examples! 💟