<commit_before>var http = require('http'),
    express = require('express'),
    db = require('../db');
var user = 'codebrag',
    password = <PASSWORD>';

function configureExpressApp() {
  var app = express();
  app.use(genericErrorHandler);
  app.use(express.basicAuth(user, password));
  app.use(express.static(__dirname + '/../../public'));
  return app;

  function genericErrorHandler(err, req, res, next) {
    res.status(500);
    res.json({ error: "Something went wrong with reports generation" });
  }
}

function initializeRoutes(app, db) {
  require('./reports_routes')(app, db);
}

function startServer(app) {
  var port = 7777;
  var httpServer = http.createServer(app);
  httpServer.listen(port);
  console.log("Codebrag reporting server started on port", port);
  return httpServer;
}


db.initialize().then(function(db) {
  var app = configureExpressApp();
  initializeRoutes(app, db);
  startServer(app);
}).done();

<commit_msg>Change stats port to 8200 (align with new staging and dogfood)<commit_after>var http = require('http'),
    express = require('express'),
    db = require('../db');
var user = 'codebrag',
    password = <PASSWORD>';

function configureExpressApp() {
  var app = express();
  app.use(genericErrorHandler);
  app.use(express.basicAuth(user, password));
  app.use(express.static(__dirname + '/../../public'));
  return app;

  function genericErrorHandler(err, req, res, next) {
    res.status(500);
    res.json({ error: "Something went wrong with reports generation" });
  }
}

function initializeRoutes(app, db) {
  require('./reports_routes')(app, db);
}

function startServer(app) {
  var port = 8200;
  var httpServer = http.createServer(app);
  httpServer.listen(port);
  console.log("Codebrag reporting server started on port", port);
  return httpServer;
}


db.initialize().then(function(db) {
  var app = configureExpressApp();
  initializeRoutes(app, db);
  startServer(app);
}).done();


{'fraction_non_alphanumeric': 0.15938303341902313, 'fraction_numerical': 0.009254498714652956, 'mean_word_length': 4.450980392156863, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '667086', 'n_tokens_mistral': 619, 'n_tokens_neox': 598, 'n_words': 148}