<commit_before>'use strict';

var all = require('bluebird').all;

var router = require('quinn.router');
var respond = require('quinn.respond');

var route = router.route;
var getParam = router.getParam;

var app = route(function(router) {
  var GET = router.GET;

  GET('/', function() {
    return 'Root level route';
  });

  GET('/hello/{name}', function() {
    return 'Hello, ' + getParam('name');
  });

  GET('/json', function() {
    return respond.json({ error: 'Invalid parameters' })
      .status(400);
  });

  GET('/nested', function() {
    // This simulates return values from other actions
    return all([ respond.json({ a: 42 }), respond('foo') ])
      .spread(function(data, text) {
        return {
          data: data,
          text: text,
          now: new Date(),
          r: [ /foo/, /bar/g ]
        };
      })
      .then(respond.json);
  });
});

module.exports = app;

if (require.main === module) {
  var http = require('http');
  var quinn = require('../');

  var server = http.createServer(quinn(app));
  server.listen(3000);<commit_msg>The RegExp sillyness is not supported anymore<commit_after>'use strict';

var all = require('bluebird').all;

var router = require('quinn.router');
var respond = require('quinn.respond');

var route = router.route;
var getParam = router.getParam;

var app = route(function(router) {
  var GET = router.GET;

  GET('/', function() {
    return 'Root level route';
  });

  GET('/hello/{name}', function() {
    return 'Hello, ' + getParam('name');
  });

  GET('/json', function() {
    return respond.json({ error: 'Invalid parameters' })
      .status(400);
  });

  GET('/nested', function() {
    // This simulates return values from other actions
    return all([ respond.json({ a: 42 }), respond('foo') ])
      .spread(function(data, text) {
        return {
          data: data,
          text: text,
          now: new Date()
        };
      })
      .then(respond.json);
  });
});

module.exports = app;

if (require.main === module) {
  var http = require('http');
  var quinn = require('../');

  var server = http.createServer(quinn(app));
  server.listen(3000);
{'fraction_non_alphanumeric': 0.18169144981412638, 'fraction_numerical': 0.008364312267657992, 'mean_word_length': 2.8309608540925266, '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': '3342059', 'n_tokens_mistral': 688, 'n_tokens_neox': 665, 'n_words': 174}