<commit_before>const request = require('request');

module.exports = (req, res, next) => {
  console.log('-> search controller entry point');
  // console.log(`* request search for ingredient: ${req.params.ingredient}`);
  // const startTime = Date.now();
  req.start = Date.now();
  request(`http://food2fork.com/api/search?key=23a189635e90b56842dee3b32139deac&q=${req.params.ingredient}`, (err, resp, html) => {
    // console.log('* search request round trip = ', Date.now() - startTime);
    req.parsedData = JSON.parse(html).recipes;
    next();
  });
};<commit_msg>lower max number of recipe results from 30 to 10<commit_after>const request = require('request');
const MAX_NUM_RESULTS = 10;

module.exports = (req, res, next) => {
  console.log('-> search controller entry point');
  // console.log(`* request search for ingredient: ${req.params.ingredient}`);
  // const startTime = Date.now();
  req.start = Date.now();
  request(`http://food2fork.com/api/search?key=23a189635e90b56842dee3b32139deac&q=${req.params.ingredient}`, (err, resp, html) => {
    // console.log('* search request round trip = ', Date.now() - startTime);
    req.parsedData = JSON
      .parse(html)
      .recipes
      .slice(0, MAX_NUM_RESULTS);
    next();
  });
};
{'fraction_non_alphanumeric': 0.1805111821086262, 'fraction_numerical': 0.04073482428115016, 'mean_word_length': 4.032128514056225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6945343', 'n_tokens_mistral': 451, 'n_tokens_neox': 418, 'n_words': 90}