title: What is the purpose of Node.js module.exports and how do you use it?
body: <p>What is the purpose of Node.js <code>module.exports</code> and how do you use it?</p>
  <p>I can't seem to find any information on this, but it appears to be a rather important part of Node.js as I often see it in source code.</p>
  <p>According to the <a href="http://nodejs.org/docs/v0.4.2/api/globals.html#module" rel="noreferrer">Node.js documentation</a>:</p>
  <blockquote>
  <p><strong>module</strong></p>
  <p>A reference to the current
  <code>module</code>. In particular <code>module.exports</code>
  is the same as the exports object. See
  <code>src/node.js</code> for more information.</p>
  </blockquote>
  <p>But this doesn't really help.</p>
  <p>What exactly does <code>module.exports</code> do, and what would a simple example be?</p>