1 | <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>
|
2 | ![tv Logo](https://raw.github.com/spumko/tv/master/images/tv.png)
|
3 |
|
4 | Interactive debug console plugin for [**hapi**](https://github.com/spumko/hapi)
|
5 |
|
6 | [![Build Status](https://secure.travis-ci.org/spumko/tv.png)](http://travis-ci.org/spumko/tv)
|
7 |
|
8 | The debug console is a simple web page in which developers can subscribe to a debug id (or * for all), and then include that
|
9 | debug id as an extra query parameter with each request. The server will use WebSocket to stream the subscribed request logs to
|
10 | the web page in real-time. To enable the debug console in a **hapi** application, install **tv** and require it using either the _'composer'_ configuration or with the _'plugin'_ interface. Below is an example of incuding **tv** using the _'pack'_ interface:
|
11 |
|
12 | ```javascript
|
13 | var Hapi = require('hapi');
|
14 |
|
15 | var server = new Hapi.Server();
|
16 | var options = {
|
17 | webSocketPort: 3000,
|
18 | debugEndpoint: '/debug/console',
|
19 | queryKey: 'debug'
|
20 | };
|
21 |
|
22 | server.pack.require('./tv', options, function (err) {
|
23 |
|
24 | if (!err) {
|
25 | server.start();
|
26 | }
|
27 | });
|
28 | ```
|
29 |
|
30 |
|
31 | ### Debug
|
32 |
|
33 | The debug console is a simple web page in which developers can subscribe to a debug id, and then include that debug id as an extra query parameter in each
|
34 | request. The server will use WebSockets to stream the subscribed request logs to the web page in real-time. In applications using multiple server instances,
|
35 | only one server can enable the debug interface using the default port. Below are the options available to be passed into the **tv** plugin:
|
36 |
|
37 | - `websocketPort` - the port used by the WebSocket connection. Defaults to _3000_.
|
38 | - `debugEndpoint` - the debug console request path added to the server routes. Defaults to _'/debug/console'_.
|
39 | - `queryKey` - the name or the request query parameter used to mark requests being debugged. Defaults to _debug_.
|