Quick Note HTTP Request in Node
I am only posting this because every time i need to do one I end up googling it.
var request = require('request');
var options = {
url: 'https://api.github.com/repos/request/request',
headers: {
'User-Agent': 'request'
}
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
var info = JSON.parse(body);
console.log(info.stargazers_count + " Stars");
console.log(info.forks_count + " Forks");
}
}
request(options, callback);
Taken from https://github.com/request/request
By Chris Phillips on April 28, 2018.
Exported from Medium on April 6, 2019.