Created
September 11, 2015 20:02
-
-
Save Marak/4cb2ffe899a8810e73e2 to your computer and use it in GitHub Desktop.
My first hook.io microservice
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
module['exports'] = function simpleHttpRequest (hook) { | |
// npm modules available, see: http://hook.io/modules | |
var request = require('request'); | |
request.get('http://httpbin.org/ip', function(err, res, body){ | |
if (err) { | |
return hook.res.end(err.messsage); | |
} | |
hook.res.end(body); | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment