Skip to content

Instantly share code, notes, and snippets.

@shamsher31
Last active August 29, 2015 14:25
Show Gist options
  • Save shamsher31/b127f5312aa0a51e2520 to your computer and use it in GitHub Desktop.
Save shamsher31/b127f5312aa0a51e2520 to your computer and use it in GitHub Desktop.
HapiJS TV logs
//https://www.npmjs.com/package/tv
var Hapi = require('hapi');
var Tv = require('tv');
// Create a server with a host and port
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 8000
});
// Add the route
server.route({
method: 'GET',
path:'/hello',
handler: function (request, reply) {
reply('hello world');
}
});
//go to http://localhost:8000/logs to see logs
var options = {endpoint: '/logs'};
server.register({register: Tv, options: options}, function (err) {
if (!err) {
server.start();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment