Skip to content

Instantly share code, notes, and snippets.

@geek
Created November 6, 2014 17:12
Show Gist options
  • Save geek/4cff3e89c023298330f8 to your computer and use it in GitHub Desktop.
Save geek/4cff3e89c023298330f8 to your computer and use it in GitHub Desktop.
Run, then start jenny and point to -u http://localhost:8000
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