title: How do I write a Express router to exclude a path
body: <p>I have a site that I'm writing a top of page routine that runs on every page:</p>
  
  <pre><code>app.all("*",function(req,res,next){
    https.get("this.site.com/api", do_stuff);
    next();
  }
  </code></pre>
  
  <p>And then I realize part of that function hits /api on my own site, which means when it does it will try to call itself, infinitely.</p>
  
  <p>Only the pages under /api need exclusion, so writing a route that does as little as possible makes the most sense.</p>
  
  <p>I also saw an example somewhere that looked like true regex can be used, but I couldn't make that work either.</p>
  
  <p>I tried...</p>
  
  <pre><code>app.all("!(/api*)*", ...
  </code></pre>
  
  <p>and</p>
  
  <pre><code>app.all(/!(\/api.*).*/
  </code></pre>
  
  <p>...but those doesn't seem to let anything through. I can't find exclusions in the docs, is this something Express can handle? If so, how?</p>