Created
November 6, 2014 17:12
-
-
Save geek/4cff3e89c023298330f8 to your computer and use it in GitHub Desktop.
Run, then start jenny and point to -u http://localhost:8000
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
var Hapi = require('hapi'); | |
var server = new Hapi.Server(8000); | |
var commands = []; | |
server.route({ | |
method: 'GET', | |
path: '/{path*}', | |
handler: function (request, reply) { | |
reply(commands); | |
commands = []; | |
} | |
}); | |
server.route({ | |
method: 'POST', | |
path: '/{path*}', | |
handler: function (request, reply) { | |
console.log(request.payload); | |
reply(''); | |
} | |
}); | |
server.start(function () { | |
console.log('Listening on ' + server.info.port); | |
}); | |
process.stdin.on('data', function (data) { | |
commands.push(JSON.parse(data.toString())); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment