title: How to export prototypes in node.js
body: <p>In my <code>db</code> library file, I have: </p>
  
  <pre><code>exports.slave = -&gt;
    connection = mysql.createConnection
      host: config.database.slave.host
      user: config.database.slave.username
      password: config.database.slave.password
      database: config.database.slave.database
  
    connection.connect()
  
    return connection
  </code></pre>
  
  <p>which returns <code>connection</code> if I run <code>db.slave().query("WHATEVER")</code> and executes properly. How can I extend and export a prototype, so I can just use: <code>db.slave.query("WAHTEVER")</code> instead?</p>