var express = require('express');
var router = express.Router();
var questions = require('../lib/questions');
var permits = require('../lib/permits');

router.get('/questions/:id', function(req, res, next) {
  if (questions[req.params.id]) {
    return res.json(questions[req.params.id]);
  }
  res.status(404).send('Question not found');
});

router.get('/questions/', function (req, res, next) {
    return res.json(questions);
});

router.get('/permits/:id', function(req, res, next) {
  if (permits[req.params.id]) {
    return res.json(permits[req.params.id]);
  }
  res.status(404).send('Permit not found');
});

router.get('/prereqs/:id', function(req, res, next) {
  if (prereqs[req.params.id]) {
    return res.json(prereqs[req.params.id]);
  }
  res.status(404).send('Permit not found');
});


module.exports = router;

@@ -143,16 +143,49 @@
 rmits');
+%0Avar geo = require('../lib/geo');
 %0A%0Arouter
@@ -829,16 +829,584 @@
 );%0A%7D);%0A%0A
+router.get('/api/zones', function(req, res, next) %7B%0A  if (!req.query.address) %7B%0A    return res.status(500).send('address query is required');%0A  %7D%0A%0A  geo.getAddressCandidates(req.query.address, function(err, response) %7B%0A    if (err) return next(err);%0A    geo.inHistoricalDistrict(response.candidates%5B0%5D.location, function(err, isInHistoricalDistrict) %7B%0A      if (err) return next(err);%0A      res.json(%7B%0A        address: req.query.address,%0A        location: response.candidates%5B0%5D.location,%0A        historic_district: isInHistoricalDistrict%0A      %7D);%0A    %7D);%0A  %7D);%0A%7D);%0A%0A
 %0Amodule.

add zoning api