old_contents: "use strict";
  
  var utils = require('../utils');
  
  module.exports = function (app) {
    utils.requires(app, 'routes/db');
  
    // Query a document view
    app.get('/:db/_design/:id/_view/:view', function (req, res, next) {
      var query = req.params.id + '/' + req.params.view;
      var opts = utils.makeOpts(req, req.query);
      req.db.query(query, opts, utils.sendCallback(res));
    });
  };
  
new_contents: "use strict";
  
  var utils = require('../utils'),
      extend = require('extend');
  
  module.exports = function (app) {
    utils.requires(app, 'routes/db');
  
    app.all('/:db/_design/:id/_view/:view', function (req, res, next) {
      if (req.method !== 'GET' && req.method !== 'POST') {
        return next();
      }
  
      // Check that the request body, if present, is an object.
      if (req.body && (typeof req.body !== 'object' || Array.isArray(req.body))) {
        return utils.sendJSON(res, 400, {
          reason: "Request body must be a JSON object",
          error: 'bad_request'
        });
      }
  
      var query = req.params.id + '/' + req.params.view;
      var opts = utils.makeOpts(req, extend({}, req.body, req.query));
      req.db.query(query, opts, utils.sendCallback(res));
    });
  };
  
subject: Add post handler to views route