<commit_before>// Forked workers will run this code when found to not be
// the master of the cluster.

var http = require('http');
var parseurl = require('parseurl'); // faster than native nodejs url package

// Initialize routes & their handlers (once)
var routing = require('./routing')
var basicHandler = routing.BasicHandler;
var queryHandler = routing.QueryHandler;
var routeNotImplemented = require('./helper').responses.routeNotImplemented;

module.exports = http.createServer(function (req, res) {
  var url = parseurl(req);
  var route = url.pathname;

  // Routes that do no require a `queries` parameter
  if (basicHandler.has(route)) {
    return basicHandler.handle(route, req, res);
  } else {
    // naive: only works if there is one query param, as is the case in TFB
    var queries = url.query.split('=')[1]
    queries = ~~(queries) || 1;
    queries = Math.min(Math.max(queries, 1), 500);

    if (queryHandler.has(route)) {
      return queryHandler.handle(route, queries, req, res);
    } else {
      return routeNotImplemented(req, res);
    }
  }

}).listen(8080, function() {
  console.log("NodeJS worker listening on port 8080");
});<commit_msg>Query routes work without queries param<commit_after>// Forked workers will run this code when found to not be
// the master of the cluster.

var http = require('http');
var parseurl = require('parseurl'); // faster than native nodejs url package

// Initialize routes & their handlers (once)
var routing = require('./routing')
var basicHandler = routing.BasicHandler;
var queryHandler = routing.QueryHandler;
var routeNotImplemented = require('./helper').responses.routeNotImplemented;

module.exports = http.createServer(function (req, res) {
  var url = parseurl(req);
  var route = url.pathname;

  // Routes that do no require a `queries` parameter
  if (basicHandler.has(route)) {
    return basicHandler.handle(route, req, res);
  } else {
    // naive: only works if there is one query param, as is the case in TFB
    var queries = url.query && url.query.split('=')[1];
    queries = ~~(queries) || 1;
    queries = Math.min(Math.max(queries, 1), 500);

    if (queryHandler.has(route)) {
      return queryHandler.handle(route, queries, req, res);
    } else {
      return routeNotImplemented(req, res);
    }
  }

}).listen(8080, function() {
  console.log("NodeJS worker listening on port 8080");
});
{'fraction_non_alphanumeric': 0.12992455993294216, 'fraction_numerical': 0.01173512154233026, 'mean_word_length': 3.841784989858012, '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': '4759861', 'n_tokens_mistral': 736, 'n_tokens_neox': 707, 'n_words': 236}