<commit_before>var config = require('./config.json');

process.env.NODE_ENV = config['server']['mode'];

var logger = require('./../../Common/sources/logger');

// 2. Express server
var express = require('express');
var http = require('http');
var app = {};

if(config['ssl'])
{
	var fs = require("fs");
	var privateKey = fs.readFileSync(config['ssl']['key']).toString();
	var certificate = fs.readFileSync(config['ssl']['cert']).toString();
	app = express({key: privateKey, cert:certificate});
}
else
{
	app = express();
}
var server = http.createServer(app);

app.configure(function(){
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.static(__dirname + '/public'));
});

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

app.configure('production', function(){
    app.use(express.errorHandler());
});

var spellCheck  = require('./spellCheck');

spellCheck.install(server, function(){
	server.listen(config['server']['port'], function(){
		logger.info("Express server listening on port %d in %s mode", config['server']['port'], app.settings.env);
	});
	
	app.get('/index.html', function(req, res) {
		res.send('Server is functioning normally');
	});
});
<commit_msg>Переработан запуск сервиса орфографии по https-протоколу в соответствии со спецификацией express 3.x<commit_after>var config = require('./config.json');

process.env.NODE_ENV = config['server']['mode'];

var logger = require('./../../Common/sources/logger');

// 2. Express server
var express = require('express');

var http = require('http');
var https = require('https');

var fs = require("fs");
	
var app = express();
var server = {};

if(config['ssl'])
{
	var privateKey = fs.readFileSync(config['ssl']['key']).toString();
	var certificate = fs.readFileSync(config['ssl']['cert']).toString();
	
	var options = {key: privateKey, cert:certificate};
	
	server = https.createServer(options, app);
}
else
{
	server = http.createServer(app);
}

app.configure(function(){
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.static(__dirname + '/public'));
});

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

app.configure('production', function(){
    app.use(express.errorHandler());
});

var spellCheck  = require('./spellCheck');

spellCheck.install(server, function(){
	server.listen(config['server']['port'], function(){
		logger.info("Express server listening on port %d in %s mode", config['server']['port'], app.settings.env);
	});
	
	app.get('/index.html', function(req, res) {
		res.send('Server is functioning normally');
	});
});

{'fraction_non_alphanumeric': 0.20276162790697674, 'fraction_numerical': 0.0010901162790697674, 'mean_word_length': 5.314220183486238, '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': '3371789', 'n_tokens_mistral': 848, 'n_tokens_neox': 845, 'n_words': 176}