function apiProxy(dataAdapter) {
  return function(req, res, next) {
    var api;

    api = _.pick(req, 'query', 'method', 'body');

    api.path = apiProxy.getApiPath(req.path);
    api.api = apiProxy.getApiName(req.path);
    api.headers = {
      'x-forwarded-for': apiProxy.getXForwardedForHeader(req.headers, req.ip)
    };

    api.headers = apiProxy.setXHTTPMethodOverride(req.headers, api.headers);

    dataAdapter.request(req, api, {
      convertErrorCode: false
    }, function(err, response, body) {
      if (err) return next(err);

      // Pass through statusCode.
      res.status(response.statusCode);
      if (!response.jsonp){
        res.json(body);
      }else{
        res.jsonp(body);
      }
    });
  };
}
Middleware handler for intercepting API routes.