lib/routes.js
function addSiteController(router, site, providers) {
  if (site.dir) {
    const controller = files.tryRequire(site.dir);

    if (controller) {
      if (Array.isArray(controller.middleware)) {
        router.use(controller.middleware);
      }

      if (Array.isArray(controller.routes)) {
        attachRoutes(router, controller.routes, site);
      } else {
        log('warn', `There is no router for site: ${site.slug}`);
      }

      // Providers are the same across all sites, but this is a convenient
      // place to store it so that it's available everywhere
      _.set(site, 'providers', providers);
      // things to remember from controller
      _.assign(site, _.pick(controller, 'resolvePublishing'));
      _.assign(site, _.pick(controller, 'resolvePublishUrl'));
      _.assign(site, _.pick(controller, 'modifyPublishedData'));
    }
  }

  return router;
}
function addSiteController(router, site, providers) {
  if (site.dir) {
    const controller = files.tryRequire(site.dir);

    if (controller) {
      if (Array.isArray(controller.middleware)) {
        router.use(controller.middleware);
      }

      if (Array.isArray(controller.routes)) {
        attachRoutes(router, controller.routes, site);
      } else {
        log('warn', `There is no router for site: ${site.slug}`);
      }

      // Providers are the same across all sites, but this is a convenient
      // place to store it so that it's available everywhere
      _.set(site, 'providers', providers);
      // things to remember from controller
      _.assign(site, _.pick(controller, 'resolvePublishing'));
      _.assign(site, _.pick(controller, 'resolvePublishUrl'));
      _.assign(site, _.pick(controller, 'modifyPublishedData'));
    }
  }

  return router;
}
function addSiteController ( router , site , providers ) { if ( site . dir ) { const controller = files . tryRequire ( site . dir ) ; if ( controller ) { if ( Array . isArray ( controller . middleware ) ) { router . use ( controller . middleware ) ; } if ( Array . isArray ( controller . routes ) ) { attachRoutes ( router , controller . routes , site ) ; } else { log ( 'warn' , ` ${ site . slug } ` ) ; } // Providers are the same across all sites, but this is a convenient // place to store it so that it's available everywhere _ . set ( site , 'providers' , providers ) ; // things to remember from controller _ . assign ( site , _ . pick ( controller , 'resolvePublishing' ) ) ; _ . assign ( site , _ . pick ( controller , 'resolvePublishUrl' ) ) ; _ . assign ( site , _ . pick ( controller , 'modifyPublishedData' ) ) ; } } return router ; }
Default way to load site controllers.

@param {express.Router} router
@param {Object} site
@param {Array} providers
@returns {express.Router}
Default way to load site controllers .