code: function expressSlash(statusCode) {
      // Force a permanent redirect, unless otherwise specified.
      statusCode || (statusCode = 301);
  
      return function (req, res, next) {
          var method = req.method.toLowerCase();
  
          // Skip when the request is neither a GET or HEAD.
          if (!(method === 'get' || method === 'head')) {
              next();
              return;
          }
  
          var url      = parseURL(req.url),
              pathname = url.pathname,
              search   = url.search || '',
              hasSlash = pathname.charAt(pathname.length - 1) === '/';
  
          // Adjust the URL's path by either adding or removing a trailing slash.
          pathname = hasSlash ? pathname.slice(0, -1) : (pathname + '/');
  
          // Look for matching route.
          var match = testStackForMatch(req.app._router.stack, method, pathname);
  
          if (match) {
              res.redirect(statusCode, pathname + search);
          } else {
              next();
          }
      };
  }
docs: -----------------------------------------------------------------------------