title: App base path from a module in NodeJS
body: <p>I'm building a web app in NodeJS, and I'm implementing my API routes in separate modules. In one of my routes I'm doing some file manipulation and I need to know the base app path. if I use <code>__dirname</code> it gives me the directory that houses my module of course.</p>
  
  <p>I'm currently using this to get the base app path (given that I know the relative path to the module from base path):</p>
  
  <pre><code>path.join(__dirname, "../../", myfilename)
  </code></pre>
  
  <p>Is there a better way than using <code>../../</code>? I'm running Node under Windows so there is no <code>process.env.PWD</code> and I don't want to be platform specific anyway.</p>