Skip to content

Instantly share code, notes, and snippets.

@sbellity
Created July 24, 2015 09:16
Show Gist options
  • Save sbellity/e03f4ba5f3ae1fc0cf24 to your computer and use it in GitHub Desktop.
Save sbellity/e03f4ba5f3ae1fc0cf24 to your computer and use it in GitHub Desktop.
My first hook.io microservice
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