<commit_before>var express = require('express'),
    http = require('http'),
    https = require('https'),
    fs = require('fs'),
    config = require('./config.json'),
    routes = require('./src/routes.js'),
    httpsApp = express(),
    httpApp = express();

//CORS
var allowCrossDomain = function(req, res, next) {
    res.header('Access-Control-Allow-Origin', "*");
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
    res.header('Access-Control-Allow-Headers', 'content-type, authorization, content-length, x-requested-with');
    next();
}

httpApp.use(allowCrossDomain);                  //allow CORS requests
routes.setup(httpApp);

//General error handling
httpApp.use(function(err, req, res, next){
    res.json(400, {"message":"Bad or invalid request, this may occur from improperly formatted input.", "code": 400});
});

//CREATE SERVER HTTP
http.createServer(httpApp).listen(config.http.port);
console.log("http  is listening on port", config.http.port);


if(config.https != null) {

    //MIDDLEWARE
    httpsApp.use(allowCrossDomain);                  //allow CORS requests
    routes.setup(httpsApp);

    //General error handling
    httpsApp.use(function(err, req, res, next){
        res.json(400, {"message":"Bad or invalid request, this may occur from improperly formatted input.", "code": 400});
    });

    //SSL MANAGEMENT
    var sslOptions = {},
        key = config.https.key,
        cert = config.https.cert,
        ca = config.https.ca;

    if(typeof key !== "undefined") {
        sslOptions.key = fs.readFileSync(key, 'utf8');
    }
    if(typeof cert !== "undefined") {
        sslOptions.cert = fs.readFileSync(cert, 'utf8');
    }
    if(typeof ca !== "undefined") {
        sslOptions.ca = [];
        for(var ci = 0; ci < ca.length; ci++) {
            var caFile = ca[ci];
            sslOptions.ca.push(fs.readFileSync(caFile, 'utf8'));
        }
    }

    //CREATE SERVER HTTPS
    https.createServer(sslOptions, httpsApp).listen(config.https.port);
    console.log("https is listening on port", config.https.port);
}<commit_msg>get rid of the general error messages... they do not appear to do what i thought they did.<commit_after>var express = require('express'),
    http = require('http'),
    https = require('https'),
    fs = require('fs'),
    config = require('./config.json'),
    routes = require('./src/routes.js'),
    httpsApp = express(),
    httpApp = express();

//CORS
var allowCrossDomain = function(req, res, next) {
    res.header('Access-Control-Allow-Origin', "*");
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
    res.header('Access-Control-Allow-Headers', 'content-type, authorization, content-length, x-requested-with');
    next();
}

httpApp.use(allowCrossDomain);                  //allow CORS requests
routes.setup(httpApp);

//CREATE SERVER HTTP
http.createServer(httpApp).listen(config.http.port);
console.log("http  is listening on port", config.http.port);


if(config.https != null) {

    //MIDDLEWARE
    httpsApp.use(allowCrossDomain);                  //allow CORS requests
    routes.setup(httpsApp);

    //SSL MANAGEMENT
    var sslOptions = {},
        key = config.https.key,
        cert = config.https.cert,
        ca = config.https.ca;

    if(typeof key !== "undefined") {
        sslOptions.key = fs.readFileSync(key, 'utf8');
    }
    if(typeof cert !== "undefined") {
        sslOptions.cert = fs.readFileSync(cert, 'utf8');
    }
    if(typeof ca !== "undefined") {
        sslOptions.ca = [];
        for(var ci = 0; ci < ca.length; ci++) {
            var caFile = ca[ci];
            sslOptions.ca.push(fs.readFileSync(caFile, 'utf8'));
        }
    }

    //CREATE SERVER HTTPS
    https.createServer(sslOptions, httpsApp).listen(config.https.port);
    console.log("https is listening on port", config.https.port);
}
{'fraction_non_alphanumeric': 0.16012396694214875, 'fraction_numerical': 0.005165289256198347, 'mean_word_length': 2.9200404858299596, 'pattern_counts': {'":': 4, '<': 5, '<?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': '6549126', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1173, 'n_words': 265}