Allow `appAttributes` to be a function for lazy-instantiation based on `req` and `res`.
function getAppAttributes(attrs, req, res) {
      if (typeof attrs === 'function') {
        attrs = attrs(req, res);
      }
      return attrs || {};
    }