<commit_before>// this is the router that instructs the server 'what to do' depending on which endpoint
const express = require('express');
const googleController = require('./googleController');
const router = express.Router(); 

//in the future we can do (/'endpoint', check Redis for result, googleAPIController)
router.get('/museum', (req, res) => {
  // console.log('look for coordinates in here', req);
  googleController.getMuseumData(37.7825177, -122.4106772, (err, data) =>{
    if (err) {
      //parsing error
      res.send(err);
    } else {
      //sending back the client response
      if (data === null) {
        //data was not found
        res.sendStatus(204); 
      } else {
        //data is found
        res.status(200).json(data); 
      }
    }
  });
});

//404 all other routes
router.use('*', (req, res) => {
  res.status(404).send();
});

module.exports = router;<commit_msg>refactor callback from get'endpoint'Data to getData<commit_after>// this is the router that instructs the server 'what to do' depending on which endpoint
const express = require('express');
const googleController = require('./googleController');
const router = express.Router(); 

//in the future we can do (/'endpoint', check Redis for result, googleAPIController)
//refactor googleController's get functionality
//refactor router callback!
//
router.get('/museum', (req, res) => {
  // console.log('look for coordinates in here', req);
  googleController.getData('museum', 37.7825177, -122.4106772, (err, data) =>{
    if (err) {
      //parsing error
      res.send(err);
    } else {
      //sending back the client response
      if (data === null) {
        //data was not found
        res.sendStatus(204); 
      } else {
        //data is found
        res.status(200).json(data); 
      }
    }
  });
});

router.get('/park', (req, res) => {
  // console.log('look for coordinates in here', req);
  googleController.getData('park', 37.7825177, -122.4106772, (err, data) =>{
    if (err) {
      //parsing error
      res.send(err);
    } else {
      //sending back the client response
      if (data === null) {
        //data was not found
        res.sendStatus(204); 
      } else {
        //data is found
        res.status(200).json(data); 
      }
    }
  });
});

router.get('/bank', (req, res) => {
  // console.log('look for coordinates in here', req);
  googleController.getData('bank', 37.7825177, -122.4106772, (err, data) =>{
    if (err) {
      //parsing error
      res.send(err);
    } else {
      //sending back the client response
      if (data === null) {
        //data was not found
        res.sendStatus(204); 
      } else {
        //data is found
        res.status(200).json(data); 
      }
    }
  });
});




//404 all other routes
router.use('*', (req, res) => {
  res.status(404).send();
});

module.exports = router;
{'fraction_non_alphanumeric': 0.1586471408647141, 'fraction_numerical': 0.03905160390516039, 'mean_word_length': 2.5073349633251834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1621929', 'n_tokens_mistral': 963, 'n_tokens_neox': 883, 'n_words': 256}