server/middleware/load-pages.js
function loadPages (req, res, next) {
  const { zlSite } = res.locals;

  // get site (or subsite) pages
  var app = req.app;

  // build tree of allowed menu/states for this user
  app.models.zlSiteContentSet.menupages(zlSite.zsId, req, res, (err, pages) => {
      // add pages to response
      zlSite.pages = _.cloneDeep(pages);
      next();
  });
}
function loadPages (req, res, next) {
  const { zlSite } = res.locals;

  // get site (or subsite) pages
  var app = req.app;

  // build tree of allowed menu/states for this user
  app.models.zlSiteContentSet.menupages(zlSite.zsId, req, res, (err, pages) => {
      // add pages to response
      zlSite.pages = _.cloneDeep(pages);
      next();
  });
}
loads pages