A super tiny method for elegantly handling requests using the Unirest library.
npm install unirest-request-handler
Implementation is simple:
const unirest = require('unirest');
const requestHandler = require('unirest-request-handler');
requestHandler
.handle(unirest.get('https://google.com/'))
.then(function(html) {
// do stuff
})
.catch(function(err) {
// handle error
});
Copyright (c) 2017 Michael Scott. Licensed under the MIT license.