<commit_before>// Core modules
fs = require('fs')
http = require('http');

// Node modules
mst = require('mustache')

// App modules
config = require('./config')
util = require('./lib/util')

// Read the current JSON log file
var log = util.readLog(config.log_json_file)

// Read the template
var template = fs.readFileSync(config.view_file)

// Render the template with colours from log
var output = mst.render(template.toString(), { colours: log });

// Create a server
http.createServer(function (req, res) {
	res.writeHead(200, {'Content-Type': 'text/html'});
	res.end(output);
}).listen(config.server_port, config.server_address);

console.log('Server running at http://%s:%s/', config.server_address, config.server_port);
console.log('Close with CTRL + C')<commit_msg>Added routes to server to enable style.css<commit_after>// Core modules
fs = require('fs')
http = require('http');

// Node modules
mst = require('mustache')

// App modules
config = require('./config')
util = require('./lib/util')

// Create a server
http.createServer(function (req, res) {

	// Status unless stated otherwise
	var status = 200

	// Content type unless otherwise stated
	var content_type = 'text/html'

	if(req.url == '/') {
		// Read the current JSON log file
		var log = util.readLog(config.log_json_file)

		// Read the template
		var template = fs.readFileSync(config.view_file)

		// Render the template with colours from log
		var output = mst.render(template.toString(), { colours: log })
	}
	else if(req.url ==  '/style.css') {
		// Read the css file
		var output = fs.readFileSync(config.style_file)

		// Set content_type
		var content_type = 'text/css'
	}
	else {
		// Read the css file
		var output = '404 Page Not Found'

		// Change status
		var status = 404
	}

	// Write the headers
	res.writeHead(status, {'Content-Type': content_type})

	// Send the result with output
	res.end(output)
	
}).listen(config.server_port, config.server_address);

console.log('Server running at http://%s:%s/', config.server_address, config.server_port);
console.log('Close with CTRL + C')
{'fraction_non_alphanumeric': 0.14629451395572665, 'fraction_numerical': 0.005774783445620789, 'mean_word_length': 3.9148936170212765, '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': '1935408', 'n_tokens_mistral': 686, 'n_tokens_neox': 651, 'n_words': 192}