Node.js print directory files
<p>Currently working on a small project and having a few issues with getting files to print onto the page. 
Currently, all files within my /views directory will print, however, I am wanting to expand this so it can print files within folders, for example, /views/test/prototype.html.</p>

<pre><code>module.exports = function (router) {

  var fs = require('fs');

  router.get('/file-list', function (req, res) {

    var markup = function (files, callback) {
      var items = [];
      for (i = 0; i &lt; files.length; i++) {
        var q = files[i];
        q = q.slice(0, -5);
        var markup = '&lt;li&gt;' + '&lt;a href="' + q + '"&gt;' + q + '&lt;/a&gt;' + '&lt;/li&gt;';
        items.push(markup);
      };
      callback(items);
    };

    var getFiles = function (callback) {
      fs.readdir(__dirname + '/views', function (err, files) { // '/' denotes the root folder
        if (err) throw err;
        markup(files, callback)
      });
    };

    getFiles(function (items) {

      // render markup for items
      res.render('file-list', { 'files': items });
    });
  });
}
</code></pre>