Created
April 16, 2014 15:46
-
-
Save Stwissel/10896955 to your computer and use it in GitHub Desktop.
Revisions
-
Stwissel created this gist
Apr 16, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ var httpProxy = require('http-proxy'); // Create an array of selects that harmon will process. var actions = []; var actionOne = {}; actionOne.query ='body'; actionOne.func = function (node) { var out = '<h1>You have been proxied</h1>'; node.createWriteStream({ outer: true }).end(out); console.log("body function called: " + out); }; var actionTwo = {}; actionTwo.query = 'head'; actionTwo.func = function (node) { var out = '<style type="text/css"> h1 {color : red; border-bottom : 5px solid green} </style>'; node.createWriteStream({ outer: true }).end(out); console.log("head function called: " + out); }; actions.push(actionOne); actions.push(actionTwo); var proxy = httpProxy.createServer( require('../')([], actions), 80, 'www.notessensei.com' ); proxy.listen(8899); console.log("Up and running on port 8899 for NotesSensei");