// 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;
@@ -294,16 +294,95 @@
 roller)%0A
+//refactor googleController's get functionality%0A//refactor router callback!%0A//%0A
 router.g
@@ -492,19 +492,957 @@
 .get
-MuseumData(
+Data('museum', 37.7825177, -122.4106772, (err, data) =%3E%7B%0A    if (err) %7B%0A      //parsing error%0A      res.send(err);%0A    %7D else %7B%0A      //sending back the client response%0A      if (data === null) %7B%0A        //data was not found%0A        res.sendStatus(204); %0A      %7D else %7B%0A        //data is found%0A        res.status(200).json(data); %0A      %7D%0A    %7D%0A  %7D);%0A%7D);%0A%0Arouter.get('/park', (req, res) =%3E %7B%0A  // console.log('look for coordinates in here', req);%0A  googleController.getData('park', 37.7825177, -122.4106772, (err, data) =%3E%7B%0A    if (err) %7B%0A      //parsing error%0A      res.send(err);%0A    %7D else %7B%0A      //sending back the client response%0A      if (data === null) %7B%0A        //data was not found%0A        res.sendStatus(204); %0A      %7D else %7B%0A        //data is found%0A        res.status(200).json(data); %0A      %7D%0A    %7D%0A  %7D);%0A%7D);%0A%0Arouter.get('/bank', (req, res) =%3E %7B%0A  // console.log('look for coordinates in here', req);%0A  googleController.getData('bank', 
 37.7
@@ -1773,21 +1773,24 @@
 %7D%0A  %7D);%0A
-
 %7D);%0A%0A
+%0A%0A%0A
 //404 al

refactor callback from get'endpoint'Data to getData