Created
March 9, 2017 19:30
-
-
Save trieloff/f6bbecebaa132e665a2a5edc5c81d5e3 to your computer and use it in GitHub Desktop.
This file contains 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