lib/render.js
function renderPage(uri, req, res, hrStart) {
  const locals = res.locals,
    extension = getExtension(req),
    renderer = findRenderer(extension);

  // Add request route params, request query params
  // and the request extension to the locals object
  locals.params = req.params;
  locals.query = req.query;
  locals.extension = extension;

  // look up page alias' component instance
  return getDBObject(uri)
    .then(formDataFromLayout(locals, uri))
    .then(data => {
      logTime(hrStart, uri);
      return data;
    })
    .then(({ data, options }) => renderer.render(data, options, res))
    .catch(responses.handleError(res));
}
function renderPage(uri, req, res, hrStart) {
  const locals = res.locals,
    extension = getExtension(req),
    renderer = findRenderer(extension);

  // Add request route params, request query params
  // and the request extension to the locals object
  locals.params = req.params;
  locals.query = req.query;
  locals.extension = extension;

  // look up page alias' component instance
  return getDBObject(uri)
    .then(formDataFromLayout(locals, uri))
    .then(data => {
      logTime(hrStart, uri);
      return data;
    })
    .then(({ data, options }) => renderer.render(data, options, res))
    .catch(responses.handleError(res));
}
function renderPage ( uri , req , res , hrStart ) { const locals = res . locals , extension = getExtension ( req ) , renderer = findRenderer ( extension ) ; // Add request route params, request query params // and the request extension to the locals object locals . params = req . params ; locals . query = req . query ; locals . extension = extension ; // look up page alias' component instance return getDBObject ( uri ) . then ( formDataFromLayout ( locals , uri ) ) . then ( data => { logTime ( hrStart , uri ) ; return data ; } ) . then ( ( { data , options } ) => renderer . render ( data , options , res ) ) . catch ( responses . handleError ( res ) ) ; }
Render a page with the appropriate renderer
@param  {String} uri
@param  {Object} req
@param  {Object} res
@param  {Object} hrStart
@return {Promise}
Render a page with the appropriate renderer