<commit_before>var find = require('reactor/find'),
    serializer = require('./serializer'),
    url = require('url');

function say () {
  var all = [].slice.call(arguments),
      filtered = all.filter(function (argument) { return argument !== say });
  console.log.apply(console, filtered);
  if (filtered.length != all.length) process.exit(1);
}

exports.create = function (base, context) {
  var reactor = require('reactor').createReactor();
  find(base, 'stencil').forEach(function (route) {
    reactor.get(route.route, function (params, request, response, next) {
      var pathInfo = params.pathInfo ? '/' + params.pathInfo : '';
      context.generate(route.script, { pathInfo: pathInfo }, function (error, stencil) {
        if (error) {
          next(error);
        } else {
          response.setHeader("Content-Type", "text/html; charset=utf8");
          response.end(serializer(stencil.document.documentElement));
        }
      });
    });
  });
  return function (req, res, next){
    if (!reactor.react(req.method, url.parse(req.url).pathname, req, res, next)) next();
  }
}<commit_msg>Add `request` and `response` to context.<commit_after>var find = require('reactor/find'),
    serializer = require('./serializer'),
    url = require('url');

function say () {
  var all = [].slice.call(arguments),
      filtered = all.filter(function (argument) { return argument !== say });
  console.log.apply(console, filtered);
  if (filtered.length != all.length) process.exit(1);
}

exports.create = function (base, context) {
  var reactor = require('reactor').createReactor();
  find(base, 'stencil').forEach(function (route) {
    reactor.get(route.route, function (params, request, response, next) {
      var pathInfo = params.pathInfo ? '/' + params.pathInfo : '';
      context.generate(route.script, {
        request: request, response: response, pathInfo: pathInfo
      }, function (error, stencil) {
        if (error) {
          next(error);
        } else {
          response.setHeader("Content-Type", "text/html; charset=utf8");
          response.end(serializer(stencil.document.documentElement));
        }
      });
    });
  });
  return function (req, res, next){
    if (!reactor.react(req.method, url.parse(req.url).pathname, req, res, next)) next();
  }
}
{'fraction_non_alphanumeric': 0.16775599128540306, 'fraction_numerical': 0.0017429193899782135, 'mean_word_length': 3.340264650283554, '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': '6902866', 'n_tokens_mistral': 692, 'n_tokens_neox': 684, 'n_words': 149}