Last active
August 29, 2015 14:25
-
-
Save Marak/dae1d76156e19dd3e3f8 to your computer and use it in GitHub Desktop.
hook.io example microservice for composing two hooks together with stream.pipe()
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
// Connect two Hooks together using .pipe() | |
module['exports'] = function pipeHook (hook) { | |
// hook.open will create a stream to the echo hook | |
// hook.open is for convience. Any stream will work. | |
var stream = hook.open('https://hook.io/Marak/examples-helloWorld'); | |
// Once we have created a stream to helloWorld, | |
// pipe that stream to the client. | |
// This techinque can be used on any streaming interace | |
stream.pipe(hook.res); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment