app/templates/server/routes/index.js
function getRouteFiles (pathName) {
    var items = fs.readdirSync(pathName);
    var files = [];

    items.forEach(function(itemName) {
        var fullName = path.join(pathName, itemName);
        var fsStat = fs.statSync(fullName);

        // If directory, then scan for "routes.js"
        if (fsStat.isDirectory()) {
            getRouteFiles(fullName).forEach(function(a) {
                files.push(a);
            });
        } else if (fsStat.isFile() && itemName === 'routes.js') {
            // routes.js found, append to list
            files.push(fullName);
        }
    });

    return files;
}
function getRouteFiles (pathName) {
    var items = fs.readdirSync(pathName);
    var files = [];

    items.forEach(function(itemName) {
        var fullName = path.join(pathName, itemName);
        var fsStat = fs.statSync(fullName);

        // If directory, then scan for "routes.js"
        if (fsStat.isDirectory()) {
            getRouteFiles(fullName).forEach(function(a) {
                files.push(a);
            });
        } else if (fsStat.isFile() && itemName === 'routes.js') {
            // routes.js found, append to list
            files.push(fullName);
        }
    });

    return files;
}
function getRouteFiles ( pathName ) { var items = fs . readdirSync ( pathName ) ; var files = [ ] ; items . forEach ( function ( itemName ) { var fullName = path . join ( pathName , itemName ) ; var fsStat = fs . statSync ( fullName ) ; // If directory, then scan for "routes.js" if ( fsStat . isDirectory ( ) ) { getRouteFiles ( fullName ) . forEach ( function ( a ) { files . push ( a ) ; } ) ; } else if ( fsStat . isFile ( ) && itemName === 'routes.js' ) { // routes.js found, append to list files . push ( fullName ) ; } } ) ; return files ; }
Returns all "routes.js" files in specified directory, including sub directory

@param {String} pathName
@returns {Array}
Returns all routes . js files in specified directory including sub directory