docs: function getRouteInfo(appName, urlRequest, query, lang, user, referrer) {
  
      var activeUser = user ? {
          _id: user._id,
          name: user.username,
          role: user.role,
          user: user
      } : {};
  
      // if route info already in cache, return it
      var cacheKey = appName + '||' + lang + '||' + urlRequest;
      var cachedRouteInfo = routeInfoCache[cacheKey];
      if (!user && cachedRouteInfo) {
          cachedRouteInfo.query = query;  // query shouldn't be cached
          return cachedRouteInfo;
      }
  
      // if urlRequest ends in .html it is an amp request so treat it as such
      var isAmp = /\.html$/.test(urlRequest);
      if (isAmp) {
          urlRequest = urlRequest.substring(0, urlRequest.length - 5);
      }
  
      // get the routes and then find the info that matches the current URL
      var url = urlRequest.toLowerCase();
      var i, route, routeInfo;
      var routes = getRoutes(appName);
      if (routes) {
          // loop through routes trying to find the one that matches
          for (i = 0; i < routes.length; i++) {
              route = routes[i];
              // if there is a match, save the info to cache and return it
              if (route.urlRegex.test(url)) {
                  routeInfo = _.extend({
                      appName:    appName,
                      referrer:   referrer,
                      lang:       lang,
                      url:        urlRequest,
                      query:      query,
                      activeUser: activeUser,
                      isAmp:      isAmp,
                      tokens:     getTokenValuesFromUrl(route.urlPattern, urlRequest)
                  }, route);
  
                  // change layout wrapper to amp if request is for amp
                  if (isAmp) {
                      routeInfo.wrapper = 'amp';
                  }
  
                  // if no user, then save request in cache
                  if (!user) {
                      routeInfoCache[cacheKey] = routeInfo;
                  }
  
                  return routeInfo;
              }
          }
      }
  
      // if we get here, then no route found, so throw 404 error
      throw new Error('404: ' + appName + ' ' + urlRequest + ' is not a valid request');
  }