<commit_before>var config = require('./config')
  , express = require('express')
  , app = express()
  , cache = require('./lib/cache')
  , tembooChoreos = require('./tembooChoreos')
  ;

app.use(express.json());
app.use(app.router);
app.use(function(err, req, res, next) {
  if (err) return internalError(res, err);
});

app.get('/', function(req, res){
  res.send('hello! temboo proxy bellow');
});

app.get('/:choreo', function(req, res){
  // GET /choreoname?q=query
  var choreo = req.params.choreo;
  if (!tembooChoreos[choreo] || typeof req.query.q === 'undefined' || req.query.q === '') {
    res.send(400, 'bad request');<commit_msg>added route to expose db.reset() and db.count()<commit_after>var config = require('./config')
  , express = require('express')
  , app = express()
  , cache = require('./lib/cache')
  , tembooChoreos = require('./tembooChoreos')
  ;

app.use(express.json());
app.use(app.router);
app.use(function(err, req, res, next) {
  if (err) return internalError(res, err);
});

app.get('/', function(req, res){
  res.send('hello! temboo proxy bellow');
});

app.get('/db/:action', function(req, res){
  // GET /db/count
  // GET /db/reset
  var action = req.params.action;
  if (action === "count") {
    cache.count(function(err, count){
      res.send("cache count: "+count);
    });
  } else if (action === "reset") {
    cache.reset(function(err, count){
      res.send("cache is empty");
    });
  } else {
    res.send(400, 'bad request');
  };
});

app.get('/:choreo', function(req, res){
  // GET /choreoname?q=query
  var choreo = req.params.choreo;
  if (!tembooChoreos[choreo] || typeof req.query.q === 'undefined' || req.query.q === '') {
    res.send(400, 'bad request');
{'fraction_non_alphanumeric': 0.21503496503496503, 'fraction_numerical': 0.005244755244755245, 'mean_word_length': 3.7827298050139277, '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': '4682115', 'n_tokens_mistral': 632, 'n_tokens_neox': 622, 'n_words': 128}