<commit_before>//jshint node: true
var express    = require('express'),
    http       = require('http'),
    bodyParser = require('body-parser'),
    activity   = require('./lib/index');
process.on('uncaughtException', function (err) {
  "use strict";
  console.error("Uncaught Exception");
  console.error(err);
  console.error(err.stack);
});

var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
var port = process.env.PORT || 9250;
var host = process.env.HOST || "127.0.0.1";

// Serve samples
if (process.env.SAMPLE) {
  app.use(express.static(__dirname + '/sample/'));
}

// Enable CORS
app.use(function(req, res, next) {
  "use strict";
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Requester");
  next();
});

// Starts the server itself
var httpServer = http.createServer(app).listen(port, host, function() {
  "use strict";
  console.log("Server listening to %s:%d within %s environment", host, port, app.get('env'));
});
app.use(activity({httpServer: httpServer}));<commit_msg>Fix CORS headers<commit_after>//jshint node: true
var express    = require('express'),
    http       = require('http'),
    bodyParser = require('body-parser'),
    activity   = require('./lib/index');
process.on('uncaughtException', function (err) {
  "use strict";
  console.error("Uncaught Exception");
  console.error(err);
  console.error(err.stack);
});

var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
var port = process.env.PORT || 9250;
var host = process.env.HOST || "127.0.0.1";

// Serve samples
if (process.env.SAMPLE) {
  app.use(express.static(__dirname + '/sample/'));
}

// Enable CORS
app.use(function(req, res, next) {
  "use strict";
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "GET,POST,DELETE,OPTIONS");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Requester");
  next();
});

// Starts the server itself
var httpServer = http.createServer(app).listen(port, host, function() {
  "use strict";
  console.log("Server listening to %s:%d within %s environment", host, port, app.get('env'));
});
app.use(activity({httpServer: httpServer}));
{'fraction_non_alphanumeric': 0.19341392246769487, 'fraction_numerical': 0.008336807002917883, 'mean_word_length': 4.673758865248227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6215409', 'n_tokens_mistral': 792, 'n_tokens_neox': 779, 'n_words': 162}