Created
July 23, 2015 03:41
-
-
Save Marak/df5e72cfbb238a6801d1 to your computer and use it in GitHub Desktop.
My first hook.io microservice
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
module['exports'] = function echo (hook) { | |
// Access Node.js HTTP Request and Response objects | |
var req = hook.req, | |
res = hook.res; | |
// Use NPM Modules | |
var faker = require('faker'); | |
res.write('<strong>BYE BILLY</strong> '); | |
res.write(req.headers["x-forwarded-for"] + '<br/>'); | |
res.end(faker.hacker.phrase()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment