<commit_before>import express = require('express');
import http = require('http');
import path = require('path');
import cc = require("./../ServerComponents/dynamic/ClientConnection");
import creator = require('./../ServerComponents/creator/MapLayerFactory');
import ProjectRepositoryService = require('./../ServerComponents/creator/ProjectRepositoryService');
import DataSource = require("./../ServerComponents/dynamic/DataSource");
import MessageBus = require('./../ServerComponents/bus/MessageBus');
import BagDatabase = require('./../ServerComponents/database/BagDatabase');
import ConfigurationService = require('./../ServerComponents/configuration/ConfigurationService');
import DynamicProject = require("./../ServerComponents/dynamic/DynamicProject");
import LayerDirectory = require("./../ServerComponents/dynamic/LayerDirectory");
import store = require('./../ServerComponents/import/Store');
import ApiServiceManager = require('./../ServerComponents/api/ApiServiceManager');
import Api = require('./../ServerComponents/api/ApiManager');
import RestAPI = require('./../ServerComponents/api/RestAPI');
import MqttAPI = require('./../ServerComponents/api/MqttAPI');
import SocketIOAPI = require('./../ServerComponents/api/SocketIOAPI');
import MongoDB = require('./../ServerComponents/api/MongoDB');
import FileStorage = require('./../ServerComponents/api/FileStorage');
// import ImbAPI = require('./../ServerComponents/api/ImbAPI');
import Utils = require('./../ServerComponents/helpers/Utils');
import Winston = require('winston');

require('./../ServerComponents/helpers/DateUtils');

import FloodSim = require('./src/FloodSim');

Winston.remove(Winston.transports.Console);
Winston.add(Winston.transports.Console, {
    colorize: true,
    prettyPrint: true
});

var favicon = require('serve-favicon');
var bodyParser = require('body-parser')
var server = express();

var httpServer = require('http').Server(server);
var cm = new cc.ConnectionManager(httpServer);
var messageBus = new MessageBus.MessageBusService();
var config = new ConfigurationService('./configuration.json');

//This line is required when using JX to run the server, or else the input-messages coming from the Excel file will cause an error: https://github.com/jxcore/jxcore/issues/119
//require('http').setMaxHeaderLength(26214400);

// all environments
var port = 3334;
server.set('port', port);
server.use(favicon(__dirname + '/public/favicon.ico'));
//increased limit size, see: http://stackoverflow.com/questions/19917401/node-js-express-request-entity-too-large
server.use(bodyParser.json({ limit: '25mb' })); // support json encoded bodies
server.use(bodyParser.urlencoded({ limit: '25mb', extended: true })); // support encoded bodies

config.add("server", "http://localhost:" + port);

var ld = new LayerDirectory.LayerDirectory(server, cm);
ld.Start();
<commit_msg>Added CORS excemption to floodsim server.<commit_after>import express = require('express');
import http = require('http');
import path = require('path');
import cc = require("./../ServerComponents/dynamic/ClientConnection");
import creator = require('./../ServerComponents/creator/MapLayerFactory');
import ProjectRepositoryService = require('./../ServerComponents/creator/ProjectRepositoryService');
import DataSource = require("./../ServerComponents/dynamic/DataSource");
import MessageBus = require('./../ServerComponents/bus/MessageBus');
import BagDatabase = require('./../ServerComponents/database/BagDatabase');
import ConfigurationService = require('./../ServerComponents/configuration/ConfigurationService');
import DynamicProject = require("./../ServerComponents/dynamic/DynamicProject");
import LayerDirectory = require("./../ServerComponents/dynamic/LayerDirectory");
import store = require('./../ServerComponents/import/Store');
import ApiServiceManager = require('./../ServerComponents/api/ApiServiceManager');
import Api = require('./../ServerComponents/api/ApiManager');
import RestAPI = require('./../ServerComponents/api/RestAPI');
import MqttAPI = require('./../ServerComponents/api/MqttAPI');
import SocketIOAPI = require('./../ServerComponents/api/SocketIOAPI');
import MongoDB = require('./../ServerComponents/api/MongoDB');
import FileStorage = require('./../ServerComponents/api/FileStorage');
// import ImbAPI = require('./../ServerComponents/api/ImbAPI');
import Utils = require('./../ServerComponents/helpers/Utils');
import Winston = require('winston');

require('./../ServerComponents/helpers/DateUtils');

import FloodSim = require('./src/FloodSim');

Winston.remove(Winston.transports.Console);
Winston.add(Winston.transports.Console, {
    colorize: true,
    prettyPrint: true
});

var favicon = require('serve-favicon');
var bodyParser = require('body-parser')
var server = express();

var httpServer = require('http').Server(server);
var cm = new cc.ConnectionManager(httpServer);
var messageBus = new MessageBus.MessageBusService();
var config = new ConfigurationService('./configuration.json');

//This line is required when using JX to run the server, or else the input-messages coming from the Excel file will cause an error: https://github.com/jxcore/jxcore/issues/119
//require('http').setMaxHeaderLength(26214400);

// all environments
var port = 3334;
server.set('port', port);
server.use(favicon(__dirname + '/public/favicon.ico'));
//increased limit size, see: http://stackoverflow.com/questions/19917401/node-js-express-request-entity-too-large
server.use(bodyParser.json({ limit: '25mb' })); // support json encoded bodies
server.use(bodyParser.urlencoded({ limit: '25mb', extended: true })); // support encoded bodies

// CORRS: see http://stackoverflow.com/a/25148861/319711
server.use(function (req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header('Access-Control-Allow-Methods', 'GET');
  res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type");
  next();
});
config.add("server", "http://localhost:" + port);

var ld = new LayerDirectory.LayerDirectory(server, cm);
ld.Start();

{'fraction_non_alphanumeric': 0.16879244657942688, 'fraction_numerical': 0.01126387278449561, 'mean_word_length': 5.541711809317444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5241743', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1596, 'n_words': 353}