Created
July 24, 2015 09:16
-
-
Save sbellity/e03f4ba5f3ae1fc0cf24 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>hello</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