<commit_before>var http = require('http'); 
var io = require('socket.io');
var url = require('url');  
var path = require('path'); 
var fs = require('fs');
var jQuery = require('jquery');
var redis = require('redis');

server = http.createServer(function(request, response){ 
    var uri = url.parse(request.url).pathname;
    if (uri === '/') {
        var filename = path.join(process.cwd(), 'index.html');
    } else {
        var filename = path.join(process.cwd(), uri);
    }
    path.exists(filename, function(exists) {  
        if (!exists) {  
            response.writeHead(404, {"Content-Type": "text/plain"});  
            response.write("404 Not Found\n");  
            response.end();  
            return;  
        }  
  
        fs.readFile(filename, "binary", function(err, file) {  
            if (err) {  
                response.writeHead(500, {"Content-Type": "text/plain"});  
                response.write(err + "\n");  
                response.end();  
                return;  
            }  
  
            response.writeHead(200);  
            response.write(file, "binary");  
            response.end();  
        });  
    });  
});
server.listen(8002);

// REDIS<commit_msg>Switch to express as the HTTP server<commit_after>var express = require('express'); 
var io = require('socket.io');
var url = require('url');  
var path = require('path'); 
var fs = require('fs');
var jQuery = require('jquery');
var redis = require('redis');

var server = require('express').createServer();

server.use('/js', express.static(process.cwd() + '/js')); 
server.use('/styles', express.static(process.cwd() + '/styles'));

server.get('/', function(request, response) {
    var filename = path.join(process.cwd(), 'index.html');
    path.exists(filename, function(exists) {  
        if (!exists) {  
            response.writeHead(404, {"Content-Type": "text/plain"});  
            response.write("404 Not Found\n");  
            response.end();  
            return;  
        }  
  
        fs.readFile(filename, "binary", function(err, file) {  
            response.writeHead(200);  
            response.write(file, "binary");  
            response.end();  
        });
    });
});

server.listen(8002);

// REDIS
{'fraction_non_alphanumeric': 0.17393238434163702, 'fraction_numerical': 0.012900355871886121, 'mean_word_length': 2.2082738944365192, 'pattern_counts': {'":': 3, '<': 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': '606826', 'n_tokens_mistral': 692, 'n_tokens_neox': 663, 'n_words': 133}