title: Reusing pg-pool via module exports
body: <p>After reading the docs: <a href="https://github.com/brianc/node-pg-pool" rel="nofollow">https://github.com/brianc/node-pg-pool</a>, I am slightly concerned about reusing the <code>new Pool()</code> method. </p>
  
  <p>The docs suggests that I need to place the <code>new Pool()</code> before <code>exports</code> and <code>return</code> it like so </p>
  
  <pre><code>// db.js
  const pool = new Pool();
  module.exports = () =&gt; { return pool; }
  </code></pre>
  
  <p>This way I can reuse <code>Pool</code> until the <code>idleTimeoutMillis</code> or <code>client.release()</code>, by using <code>require()</code> from other files
  Eg: </p>
  
  <pre><code>const connect = require('./db')
  connect().query(' .... ');  
  </code></pre>
  
  <p><strong>If this is correct</strong>, how does it work? Does node.js caches the <code>new Pool()</code>, as it not inside <code>module.exports</code>?</p>