title: Serving A Batch Of Dynamic Pages
body: <p>I have a few documentation pages I want to serve. Instead of writing something like the following, I want to essentially server them all without writing this code for every page:</p>
  
  <pre><code>jade.renderFile("/documentation/gettingStarted", {}, function(err, str) {
      if(err) throw err;
      response.send(str);
  });
  </code></pre>
  
  <p>I also would like a simple "Next Page" at the bottom of these pages, with order defined in the following array:</p>
  
  <pre><code>var pages = ["installation", "gettingStarted"];
  </code></pre>
  
  <p>The part I'm stuck on is that iterating through each page in my array with <code>app.get</code>:</p>
  
  <pre><code>for(var i = 0; i &lt; pages.length; i++) {
      var pagePath = "documentation/" + pages[i];
  
      app.get("/" + pagePath, function(request, response) {
          jade.renderFile(pagePath + ".jade", {}, function(err, str) {
              if(err) throw err;
              response.send(str);
          });
      });
  }
  </code></pre>
  
  <p>With the block above I would hope that it would server pages on the following requests:</p>
  
  <ul>
  <li><code>/documentation/installation</code></li>
  <li><code>/documentation/gettingStarted</code></li>
  </ul>
  
  <p>It works for one page, but due to the fact <code>jade.renderFile(...)</code> is called on GET, it will simply use the variables left over from the initialisation, meaning both pages will only return the last page (gettingStarted) because <code>pagePath</code> will be kept the same for both requests.</p>
  
  <p>Is there anyway to serve a bunch of files dynamically? Is it required to make call <code>app.get</code> for every individual page?</p>