<commit_before>var fs = require('fs');
var path = require('path');
var express = require('express');
var style = require('./style');
var script = require('./script');
var templates = require('./templates');

var p = path.resolve('config.json');
var config = require(p);

function init() {
	var app = express();

	app.engine('html', templates.render(config.templates));
	app.set('views', config.templates.basedir);
	app.set('view engine', 'html');

	if(config.css) {
		style.start(config.css);

		var paths = [path.resolve(config.css.paths)];

		config.css.output.forEach(function(output) {
			app.use(output.dest, style.get(path.resolve(output.filename), paths));
		})
	}

	if(config.js) {
		script.start(config.js);

		var paths = config.js.paths;

		config.js.output.forEach(function(output) {
			app.use(output.dest, script.get(path.resolve(output.filename), paths));
		})
	}

	if(config.routes) {
		var routes = require(path.resolve(config.routes));

		routes.forEach(function(route){
			app.get(route.path, function (req, res) {
				var options = {
					template: route.template
				};

				if(route.meta) options.meta = route.meta;
				if(route.data) options.data = JSON.parse(fs.readFileSync(path.resolve(route.data), 'utf8'));

				res.render(route.base, options);
			});
		})
	}

	if(config.static) {
		config.static.forEach(function(item){
			app.use(item.alias, express.static(item.dir));
		})
	}

	var server = app.listen(2000, function () {
		var host = server.address().address;
		var port = server.address().port;

		console.log('Example app listening at http://localhost:%s', port);
	});
}


module.exports = {
	init: init
}<commit_msg>env process port<commit_after>var fs = require('fs');
var path = require('path');
var express = require('express');
var style = require('./style');
var script = require('./script');
var templates = require('./templates');

var p = path.resolve('config.json');
var config = require(p);

function init() {
	var app = express();

	app.engine('html', templates.render(config.templates));
	app.set('views', config.templates.basedir);
	app.set('view engine', 'html');

	if(config.css) {
		style.start(config.css);

		var paths = [path.resolve(config.css.paths)];

		config.css.output.forEach(function(output) {
			app.use(output.dest, style.get(path.resolve(output.filename), paths));
		})
	}

	if(config.js) {
		script.start(config.js);

		var paths = config.js.paths;

		config.js.output.forEach(function(output) {
			app.use(output.dest, script.get(path.resolve(output.filename), paths));
		})
	}

	if(config.routes) {
		var routes = require(path.resolve(config.routes));

		routes.forEach(function(route){
			app.get(route.path, function (req, res) {
				var options = {
					template: route.template
				};

				if(route.meta) options.meta = route.meta;
				if(route.data) options.data = JSON.parse(fs.readFileSync(path.resolve(route.data), 'utf8'));

				res.render(route.base, options);
			});
		})
	}

	if(config.static) {
		config.static.forEach(function(item){
			app.use(item.alias, express.static(item.dir));
		})
	}

	var server = app.listen(process.env.PORT || 2000, function () {
		var host = server.address().address;
		var port = server.address().port;

		console.log('Example app listening at http://localhost:%s', port);
	});
}


module.exports = {
	init: init
}
{'fraction_non_alphanumeric': 0.18394950405770966, 'fraction_numerical': 0.003005710850616171, 'mean_word_length': 4.096477794793262, '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': '2594020', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1099, 'n_words': 201}