<commit_before>/**
 * Created by jonclark on 10/23/15.
 */
var http = require('http');
var path = require('path');
var fs = require('fs');

var mimeTypes = {
  '.js' : 'text/javascript',
  '.html': 'text/html',
  '.css' : 'text/css',
  '.eot' : 'font/opentype',
  '.svg' : 'font/opentype',
  '.ttf' : 'font/opentype',
  '.woff' : 'application/font-woff',
  '.woff2' : 'application/font-woff',
};

http.createServer(function (request, response) {
  var lookup = path.basename(decodeURI(request.url)) || 'index.html',
    f = 'content/' + lookup;
  fs.exists(f, function (exists) { //path.exists for Node 0.6 and below
    if (exists) {
      fs.readFile(f, function (err, data) {
        if (err) {response.writeHead(500); response.end('Server Error!'); return; }
        var headers = {'Content-type': mimeTypes[path.extname(lookup)]};
        response.writeHead(200, headers);
        response.end(data);
      });
      return;
    }
    response.writeHead(404); //no such file found!
    response.end('Page Not Found!');
  });

}).listen(8080);<commit_msg>fs to path for raspberry pi<commit_after>/**
 * Created by jonclark on 10/23/15.
 */
var http = require('http');
var path = require('path');
var fs = require('fs');

var mimeTypes = {
  '.js' : 'text/javascript',
  '.html': 'text/html',
  '.css' : 'text/css',
  '.eot' : 'font/opentype',
  '.svg' : 'font/opentype',
  '.ttf' : 'font/opentype',
  '.woff' : 'application/font-woff',
  '.woff2' : 'application/font-woff',
};

http.createServer(function (request, response) {
  var lookup = path.basename(decodeURI(request.url)) || 'index.html',
    f = 'content/' + lookup;
  path.exists(f, function (exists) { //path.exists for Node 0.6 and below
    if (exists) {
      fs.readFile(f, function (err, data) {
        if (err) {response.writeHead(500); response.end('Server Error!'); return; }
        var headers = {'Content-type': mimeTypes[path.extname(lookup)]};
        response.writeHead(200, headers);
        response.end(data);
      });
      return;
    }
    response.writeHead(404); //no such file found!
    response.end('Page Not Found!');
  });

}).listen(8080);
{'fraction_non_alphanumeric': 0.19775070290534208, 'fraction_numerical': 0.020618556701030927, 'mean_word_length': 3.219367588932806, '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': '7505700', 'n_tokens_mistral': 776, 'n_tokens_neox': 746, 'n_words': 166}