<commit_before>var express = require('express');
var Article = require('./models/article').Article;
var helpers = require('./helpers');

module.exports.app = function(root, configs, listen) {
  var app = express.createServer();

  configs = module.exports.setDefaultConfigs(root, configs);

  app.helpers(helpers);
  app.dynamicHelpers({
    configs: function() {
      return configs;
    }
  });

  app.configure(function() {
    for (key in configs) {
      app.set('typhoon ' + key, configs[key]);
    }

    Article.includePath = app.set('typhoon articlesDir');
    Article.extension = app.set('typhoon articlesExt');
    Article.baseUrl = app.set('typhoon baseUrl');
    Article.encoding = app.set('typhoon encoding');

    app.set('views', app.set('typhoon viewsDir'));
    app.set('view engine', app.set('typhoon viewsEngine'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());

    if (app.set('typhoon favicon')) { 
      app.use(express.favicon(app.set('typhoon favicon')));
    }

    if (app.set('typhoon staticDir')) {
      app.use(express.static(app.set('typhoon staticDir')));
    }

    app.use(app.router);
  });

  app.configure('development', function() {
    app.use(express.logger());
    app.use(express.profiler());
    app.use(express.responseTime());
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 
  });

  app.configure('production', function() {
    app.enable('cache views');
  });

  require('./routes/article').setup(app);

  app.error(function(err, req, res, next) {
    var locals = {};
    
    locals.errorCode = 500;
    locals.layout = false;<commit_msg>Changes for Express 2.3.0<commit_after>var express = require('express');
var Article = require('./models/article').Article;
var helpers = require('./helpers');

module.exports.app = function(root, configs, listen) {
  var app = express.createServer();

  configs = module.exports.setDefaultConfigs(root, configs);

  app.helpers(helpers);
  app.dynamicHelpers({
    configs: function() {
      return configs;
    }
  });

  app.configure(function() {
    for (key in configs) {
      app.set('typhoon ' + key, configs[key]);
    }

    Article.includePath = app.set('typhoon articlesDir');
    Article.extension = app.set('typhoon articlesExt');
    Article.baseUrl = app.set('typhoon baseUrl');
    Article.encoding = app.set('typhoon encoding');

    app.set('views', app.set('typhoon viewsDir'));
    app.set('view engine', app.set('typhoon viewsEngine'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());

    if (app.set('typhoon favicon')) { 
      app.use(express.favicon(app.set('typhoon favicon')));
    }

    if (app.set('typhoon staticDir')) {
      app.use(express.static(app.set('typhoon staticDir')));
    }

    app.use(app.router);
  });

  app.configure('development', function() {
    app.use(express.logger());
    app.use(express.profiler());
    app.use(express.responseTime());
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 
  });

  app.configure('production', function() {
    app.enable('view cache');
  });

  require('./routes/article').setup(app);

  app.error(function(err, req, res, next) {
    var locals = {};
    
    locals.errorCode = 500;
    locals.layout = false;
{'fraction_non_alphanumeric': 0.17709277727410094, 'fraction_numerical': 0.0027198549410698096, 'mean_word_length': 3.6619718309859155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3904316', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1062, 'n_words': 182}