Last active
March 9, 2017 14:27
-
-
Save trieloff/2ffe2609fea63b8ffccba0c1cc944784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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