<commit_before># Realtime Dashboard Server

[![Build Status](https://travis-ci.org/tanem/realtime-dashboard-server.png?branch=master)](https://travis-ci.org/tanem/realtime-dashboard-server)

The server component of a realtime dashboard application. It's based on [Express](http://expressjs.com/) and uses [Socket.IO](http://socket.io/) to emit data to connected browsers.

## Dependencies

 * [Node.js](http://nodejs.org/)
 * [npm](https://npmjs.org/)
 * [JSCoverage](http://siliconforks.com/jscoverage/)
 
Installing:

    $ npm install

## Running the server

Install all dependencies, then to start the server in the default environment (dev):

    $ node app.js

The server accepts the following command line args:

 * `NODE_ENV`: dev (default) / test / demo
 * `LOG_LEVEL`: 0 (error) / 1 (warn) / 2 (info) / 3 (debug, default)

Note that the Socket.IO logger is used for logging. The `dev` and `demo` envs default to log level 3, `test` env defaults to log level 1.

## Demo

Sample [PerformanceTiming](https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html) data is provided in the `./demo` directory. This data is sent at random intervals to the server during demo mode. The data being emitted to clients is logged to the console in debug mode.

To start the server in demo mode:

    $ NODE_ENV=demo node app.js

## Unit tests

The server unit tests use:

 * [Mocha](http://visionmedia.github.io/mocha/)
 * [expect.js](https://github.com/LearnBoost/expect.js)
 * [Sinon.JS](http://sinonjs.org/)

To run:

    $ make test

To watch for changes and execute tests:

    $ make test-w

## Unit test coverage

[JSCoverage](http://siliconforks.com/jscoverage/) is used to add instrumentation to the JavaScript code, which is output to the `./lib-cov` directory. [Mocha's](http://visionmedia.github.io/mocha/) HTMLCov reporter then captures the necessary coverage information and generates a single-page HTML report.

To generate and view the HTML coverage report:

    $ make test-cov && open coverage.html<commit_msg>README updated.<commit_after># Realtime Dashboard Server

[![Build Status](https://travis-ci.org/tanem/realtime-dashboard-server.png?branch=master)](https://travis-ci.org/tanem/realtime-dashboard-server)

The server component of a realtime dashboard application. It's based on [Express](http://expressjs.com/) and uses [Socket.IO](http://socket.io/) to emit data to connected browsers.

## Dependencies

 * [Node.js](http://nodejs.org/)
 * [npm](https://npmjs.org/)
 * [JSCoverage](http://siliconforks.com/jscoverage/)
 
Installing:

    $ npm install

## Running the server

Install all dependencies, then to start the server in the default environment (dev):

    $ node app.js

The server accepts the following command line args:

 * `NODE_ENV`: dev (default) / test / demo
 * `LOG_LEVEL`: 0 (error) / 1 (warn) / 2 (info) / 3 (debug, default)

Note that the Socket.IO logger is used for logging. The `dev` and `demo` envs default to log level 3, `test` env defaults to log level 1.

## Demo

Sample [PerformanceTiming](https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html) data is provided in the `./demo` directory. This data is sent at random intervals to the server during demo mode. The data being emitted to clients is logged to the console in debug mode.

To start the server in demo mode:

    $ NODE_ENV=demo node app.js

## Unit tests

The server unit tests use:

 * [Mocha](http://visionmedia.github.io/mocha/)
 * [expect.js](https://github.com/LearnBoost/expect.js)
 * [Sinon.JS](http://sinonjs.org/)

To run:

    $ make test

To watch for changes and execute tests:

    $ make test-w

## Unit test coverage

[JSCoverage](http://siliconforks.com/jscoverage/) is used to add instrumentation to the JavaScript code, which is output to the `./lib-cov` directory. [Mocha's](http://visionmedia.github.io/mocha/) HTMLCov reporter captures the necessary coverage information and generates a single-page HTML report `./coverage.html`

To generate the coverage report:

    $ make test-cov
{'fraction_non_alphanumeric': 0.12285012285012285, 'fraction_numerical': 0.0034398034398034397, 'mean_word_length': 3.9767726161369192, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6826151', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1231, 'n_words': 431}