<commit_before>var fs       = require('fs');
var path     = require('path');
var http     = require('http');
var pf       = require('portfinder');
var mime     = require('mime');
var exec     = require('child_process').exec;
var rstream  = require('replacestream');

module.exports = function (port, lrPort, open, next) {
  var server = http.createServer(function(req, res) {
    var request    = (req.url === '/') ? '/index.html' : req.url;
    var filePath   = path.join(process.cwd(), request);
    var mimetype   = mime.lookup(filePath);
    var fileStream = fs.createReadStream(filePath);

    // send correct mimetype
    res.writeHead(200, {'Content-type': mimetype});

    // handle errors
    fileStream.on('error', function(err) {<commit_msg>use redirect to load index.html by default<commit_after>var fs       = require('fs');
var path     = require('path');
var http     = require('http');
var pf       = require('portfinder');
var mime     = require('mime');
var exec     = require('child_process').exec;
var rstream  = require('replacestream');

module.exports = function (port, lrPort, open, next) {
  var server = http.createServer(function(req, res) {
    if (req.url === '/') {
      res.writeHead(301, {'Location': '/index.html'});
      return res.end();
    }
    var filePath   = path.join(process.cwd(), req.url);
    var mimetype   = mime.lookup(filePath);
    var fileStream = fs.createReadStream(filePath);

    // send correct mimetype
    res.writeHead(200, {'Content-type': mimetype});

    // handle errors
    fileStream.on('error', function(err) {
{'fraction_non_alphanumeric': 0.16149461684610514, 'fraction_numerical': 0.005699810006333122, 'mean_word_length': 3.3646408839779007, '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': '1174080', 'n_tokens_mistral': 508, 'n_tokens_neox': 489, 'n_words': 120}