<commit_before>exports.start = function (ip, port, docDir, callback) {
    var http = require('http');
    var fs = require('fs');
    var path = require('path');
    var rootPath = path.resolve(__dirname, '../..', docDir);
    var mimeTypes = {
        css: 'text/css',
        html: 'text/html',
        js: 'text/javascript',
        gif: 'image/gif',
        ttf: 'application/x-font-ttf',
        json: 'application/json'
    };
    http.createServer(function (req, res) {
        if (req.url === '/') req.url = 'index.html';
        var components = req.url.split('.');
        var extension = components[components.length-1];
        fs.readFile(path.join(rootPath, req.url), function (err, data) {
            if (err) {
                res.writeHead(404, {'Content-Type': 'text/plain'});
                res.end('not found');
            } else {
                if (data) {
                    res.writeHead(200, {'Content-Type': mimeTypes[extension]});
                    res.end(data);
                }
            }
        });<commit_msg>fixed webserver<commit_after>exports.start = function (ip, port, docDir, callback) {
    var http = require('http');
    var fs = require('fs');
    var path = require('path');
    var rootPath = path.resolve(__dirname, '../../..', docDir);
    var mimeTypes = {
        css: 'text/css',
        html: 'text/html',
        js: 'text/javascript',
        gif: 'image/gif',
        ttf: 'application/x-font-ttf',
        json: 'application/json'
    };
    http.createServer(function (req, res) {
        if (req.url === '/') req.url = 'index.html';
        var components = req.url.split('.');
        var extension = components[components.length-1];
        fs.readFile(path.join(rootPath, req.url), function (err, data) {
            if (err) {
                res.writeHead(404, {'Content-Type': 'text/plain'});
                res.end('not found');
            } else {
                if (data) {
                    res.writeHead(200, {'Content-Type': mimeTypes[extension]});
                    res.end(data);
                }
            }
        });
{'fraction_non_alphanumeric': 0.16800757217226692, 'fraction_numerical': 0.006625650733554188, 'mean_word_length': 1.7706422018348624, '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': '4509138', 'n_tokens_mistral': 643, 'n_tokens_neox': 623, 'n_words': 131}