<commit_before>var express = require("express"),
    app = express(),
    cors = require("cors"),
    SocketIOServer = require("socket.io"),
    EventEmitter = require("events").EventEmitter,
    mBus = new EventEmitter(),
    sockets = require("../util/sockets"),
    appDir = require("../util/appDir"),
    getIp = require("../util/getMyIp"),
    routes = require("../routes"),
    port = process.env.PORT || 8280,
    epaper;

function logErrors(err, req, res, next) {
    console.error(err.stack);
    next(err);
}

function clientErrorHandler(err, req, res, next) {
    if (req.xhr) {
        res.send(500, { error: "Something blew up!" });
    } else {
        next(err);
    }
}

module.exports = function (model, db, standalone) {
    if (!standalone) {
        epaper = require("../util/runEpaper.js");
    }

    var server = require("http").createServer(app),
        io = new SocketIOServer(server, {
            "log level": 1,
            "transports": ["flashsocket", "websocket", "polling"],
            "polling duration": 2
        });

    getIp.port(port);

    sockets(io, mBus, standalone);

    app.configure(function () {
        app.set("port", port);
        app.use(express.logger("dev"));
        app.use(express.bodyParser());
        app.use(express.cookieParser());
        app.use(cors());<commit_msg>Fixed #4 Enable gzip compression<commit_after>var express = require("express"),
    app = express(),
    cors = require("cors"),
    SocketIOServer = require("socket.io"),
    EventEmitter = require("events").EventEmitter,
    mBus = new EventEmitter(),
    sockets = require("../util/sockets"),
    appDir = require("../util/appDir"),
    getIp = require("../util/getMyIp"),
    routes = require("../routes"),
    port = process.env.PORT || 8280,
    epaper;

function logErrors(err, req, res, next) {
    console.error(err.stack);
    next(err);
}

function clientErrorHandler(err, req, res, next) {
    if (req.xhr) {
        res.send(500, { error: "Something blew up!" });
    } else {
        next(err);
    }
}

module.exports = function (model, db, standalone) {
    if (!standalone) {
        epaper = require("../util/runEpaper.js");
    }

    var server = require("http").createServer(app),
        io = new SocketIOServer(server, {
            "log level": 1,
            "transports": ["flashsocket", "websocket", "polling"],
            "polling duration": 2
        });

    getIp.port(port);

    sockets(io, mBus, standalone);

    app.configure(function () {
        app.set("port", port);
        app.use(express.logger("dev"));
        app.use(express.compress());
        app.use(express.bodyParser());
        app.use(express.cookieParser());
        app.use(cors());
{'fraction_non_alphanumeric': 0.1763409257898604, 'fraction_numerical': 0.0069801616458486405, 'mean_word_length': 2.640374331550802, 'pattern_counts': {'":': 6, '<': 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': '1524617', 'n_tokens_mistral': 871, 'n_tokens_neox': 854, 'n_words': 170}