lib/locals.js
function addAvailableRoutes(router) {
  return (req, res, next) => {
    const routes = router.stack
      .filter((r) => r.route && r.route.path) // grab only the defined routes (not api stuff)
      .map((r) => r.route.path); // pull out their paths

    res.locals.routes = routes; // and add them to the locals
    next();
  };
}
function addAvailableRoutes(router) {
  return (req, res, next) => {
    const routes = router.stack
      .filter((r) => r.route && r.route.path) // grab only the defined routes (not api stuff)
      .map((r) => r.route.path); // pull out their paths

    res.locals.routes = routes; // and add them to the locals
    next();
  };
}
function addAvailableRoutes ( router ) { return ( req , res , next ) => { const routes = router . stack . filter ( ( r ) => r . route && r . route . path ) // grab only the defined routes (not api stuff) . map ( ( r ) => r . route . path ) ; // pull out their paths res . locals . routes = routes ; // and add them to the locals next ( ) ; } ; }
Adds available site routes to locals
@param {express.Router} router
@returns {Function}
Adds available site routes to locals