Skip to content

Instantly share code, notes, and snippets.

@Marak
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marak/993da68c82e6d6c4511d to your computer and use it in GitHub Desktop.
Save Marak/993da68c82e6d6c4511d to your computer and use it in GitHub Desktop.
hook.io example microservice for saying hello world to a request
// A simple hello world microservice
// Click "Deploy Service" to deploy this code
// Service will respond to HTTP requests with a string
module['exports'] = function helloWorld (hook) {
// hook.req is a Node.js http.IncomingMessage
var host = hook.req.host;
// hook.res is a Node.js httpServer.ServerResponse
// Respond to the request with a simple string
hook.res.end(host + ' says, "Hello world!"');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment