Skip to content

Instantly share code, notes, and snippets.

@trieloff
Last active March 9, 2017 14:27
Show Gist options
  • Save trieloff/2ffe2609fea63b8ffccba0c1cc944784 to your computer and use it in GitHub Desktop.
Save trieloff/2ffe2609fea63b8ffccba0c1cc944784 to your computer and use it in GitHub Desktop.
var request = require('request-promise');
var github = {
token: null,
getUser: function() {
return request({
"method":"GET",
"uri": "https://api.github.com/user",
"json": true,
"headers": {
"Authorization": "Bearer " + github.token,
"User-Agent": "My little demo app"
}
});
}
}
function main(params) {
github.token = params.token;
return github.getUser();
}
main({"token": process.argv[2]}).then(function(result) {
console.log(result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment