Skip to content

Instantly share code, notes, and snippets.

@booyaa
Forked from anonymous/foo.js
Created February 13, 2013 11:01
Show Gist options
  • Save booyaa/4943863 to your computer and use it in GitHub Desktop.
Save booyaa/4943863 to your computer and use it in GitHub Desktop.
// inspiration: https://github.com/damienklinnert/appdotnet
var request = require('request');
foo = function(cb) {
var opts = { uri: 'http://appd01:8111' };
request.get(opts, function(err ,resp, body) {
if (err) { return cb(err); }
return cb(null, resp, body);
});
};
foo(function(err, response, body) {
if (err) {
console.log("error: %s", err);
} else {
console.log("status code: %s", response.statusCode);
console.log("body:\n %s", body);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment