<commit_before>/**
 * Spins up two web servers
 *   - http-server sends the static assets in dist and handles the /config.js endpoint
 *   - cors-proxy adds the necessary headers for xdomain access to the REST API
 */

var pkg = require('./package.json'),
    morgan = require('morgan'),
    COOPR_UI_PORT = parseInt(process.env.COOPR_UI_PORT || 8080, 10),
    COOPR_CORS_PORT = parseInt(process.env.COOPR_CORS_PORT || 8081, 10),

    configStr = JSON.stringify({
      // the following will be available in angular via the "MY_CONFIG" injectable

      COOPR_SERVER_URI: process.env.COOPR_SERVER_URI || 'http://127.0.0.1:55054/v2/',
      COOPR_CORS_PORT: COOPR_CORS_PORT,
      COOPR_UI_PORT: COOPR_UI_PORT

    });


var hilite = function (v) { return '\x1B[7m' + v + '\x1B[27m'; },
    httpLabel = '\x1B[40m\x1B[32mhttp-server\x1B[39m\x1B[49m',
    corsLabel = '\x1B[40m\x1B[35mcors-proxy\x1B[39m\x1B[49m',
    httpLogger = morgan(httpLabel+' :method :url', {immediate: true}),
    corsLogger = morgan(corsLabel+' :req[X-Loom-UserID]/:req[X-Loom-TenantID] :method :url '+hilite(':status'));

console.log(hilite(pkg.name) + ' v' + pkg.version + ' starting up...');

/**
 * HTTP server
 */
require('http-server')
  .createServer({
    root: __dirname + '/dist',
    before: [
      httpLogger,
      function (req, res) {<commit_msg>move formatting out for readability win<commit_after>/**
 * Spins up two web servers
 *   - http-server sends the static assets in dist and handles the /config.js endpoint
 *   - cors-proxy adds the necessary headers for xdomain access to the REST API
 */

var pkg = require('./package.json'),
    morgan = require('morgan'),
    COOPR_UI_PORT = parseInt(process.env.COOPR_UI_PORT || 8080, 10),
    COOPR_CORS_PORT = parseInt(process.env.COOPR_CORS_PORT || 8081, 10),

    configStr = JSON.stringify({
      // the following will be available in angular via the "MY_CONFIG" injectable

      COOPR_SERVER_URI: process.env.COOPR_SERVER_URI || 'http://127.0.0.1:55054/v2/',
      COOPR_CORS_PORT: COOPR_CORS_PORT

    });


var color = {
      hilite: function (v) { return '\x1B[7m' + v + '\x1B[27m'; },
      green: function (v) { return '\x1B[40m\x1B[32m' + v + '\x1B[39m\x1B[49m'; },
      pink: function (v) { return '\x1B[40m\x1B[35m' + v + '\x1B[39m\x1B[49m'; }
    },
    httpLabel = color.green('http-server'),
    corsLabel = color.pink('cors-proxy'),
    httpLogger = morgan(httpLabel+' :method :url', {immediate: true}),
    corsLogger = morgan(corsLabel+' :req[X-Loom-UserID]/:req[X-Loom-TenantID]' + 
                                  ' :method :url '+color.hilite(':status'));

console.log(color.hilite(pkg.name) + ' v' + pkg.version + ' starting up...');

/**
 * HTTP server
 */
require('http-server')
  .createServer({
    root: __dirname + '/dist',
    before: [
      httpLogger,
      function (req, res) {
{'fraction_non_alphanumeric': 0.15879678209164044, 'fraction_numerical': 0.03707590066456803, 'mean_word_length': 3.2433234421364987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6292895', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1066, 'n_words': 226}