<commit_before>var http = require('http');
var path = require('path');
var Static = require('node-static');

var server = new Static.Server(path.join(__dirname, '../../build'));
var port = process.env.PORT || 8080;

http.createServer(function (req, res) {
    req.addListener('end', function () {
        server.serve(req, res, function () {
            server.serveFile('/index.html', 404, {}, req, res);
        });
    }).resume();
}).listen(port);

console.log('Listening on ' + port);<commit_msg>Fixed server crashing mid-build if index.html doesn't exist<commit_after>var http = require('http');
var path = require('path');
var Static = require('node-static');

var server = new Static.Server(path.join(__dirname, '../../build'));
var port = process.env.PORT || 8080;

http.createServer(function (req, res) {
    req.addListener('end', function () {
        server.serve(req, res, function () {
            server.serveFile('/index.html', 200, {}, req, res).on('error', function (err) {
                res.statusCode = 404;
                res.end('BUILDING...');
            });
        });
    }).resume();
}).listen(port);

console.log('Listening on ' + port);
{'fraction_non_alphanumeric': 0.19572649572649573, 'fraction_numerical': 0.01452991452991453, 'mean_word_length': 3.1232394366197185, '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': '6309373', 'n_tokens_mistral': 365, 'n_tokens_neox': 345, 'n_words': 81}