lib/services/attachRoutes.js
function parseHandler(router, routeObj, site) {
  const { redirect, dynamicPage, path, middleware } = routeObj;

  if (!validPath(path, site)) {
    return;
  }

  if (middleware) {
    router.use(path, middleware);
  }

  if (redirect) {
    return attachRedirect(router, routeObj, site);
  } else if (dynamicPage) {
    return attachDynamicRoute(router, routeObj); // Pass in the page ID
  } else {
    return attachPlainRoute(router, routeObj);
  }
}
function parseHandler(router, routeObj, site) {
  const { redirect, dynamicPage, path, middleware } = routeObj;

  if (!validPath(path, site)) {
    return;
  }

  if (middleware) {
    router.use(path, middleware);
  }

  if (redirect) {
    return attachRedirect(router, routeObj, site);
  } else if (dynamicPage) {
    return attachDynamicRoute(router, routeObj); // Pass in the page ID
  } else {
    return attachPlainRoute(router, routeObj);
  }
}
function parseHandler ( router , routeObj , site ) { const { redirect , dynamicPage , path , middleware } = routeObj ; if ( ! validPath ( path , site ) ) { return ; } if ( middleware ) { router . use ( path , middleware ) ; } if ( redirect ) { return attachRedirect ( router , routeObj , site ) ; } else if ( dynamicPage ) { return attachDynamicRoute ( router , routeObj ) ; // Pass in the page ID } else { return attachPlainRoute ( router , routeObj ) ; } }
Parses site route config object.
@param {Router} router
@param {Object} routeObj - Route config
@param {Object} site
@return {Router}
Parses site route config object .