title: Nodejs: How to export multiple objects?
body: <p>I'm new to Nodejs. How to export multiple objects? For example</p>
  
  <pre><code>fs = require("fs")
  Sequelize = require 'sequelize'
  
  module.exports = (config)-&gt;
    sequelize = new Sequelize(
      config.database.name
      config.database.username
      config.database.password
      config.database.options
    )
  
    fs.readdirSync(config.root+'/server/models/').forEach (file)-&gt;
      module.exports['Page'] = sequelize.import(config.root + '/server/models/' + file) # --&gt; export this model 
    sequelize # --&gt; export this object
  </code></pre>
  
  <p>I want to use <code>Page</code> model something like:</p>
  
  <pre><code>Page = require('./models').Page
  </code></pre>
  
  <p>I want to use <code>Sequelize</code> object something like:</p>
  
  <pre><code>Sequelize = require('./models').Sequelize
  </code></pre>
  
  <p>Thank you for advice :D</p>
  
  <p><strong>UPDATED</strong>:
  Solved following way:</p>
  
  <pre><code>fs = require("fs")
  Sequelize = require 'sequelize'
  
  module.exports = (config)-&gt;
    @Sequelize = new Sequelize(
      config.database.name
      config.database.username
      config.database.password
      config.database.options
    )
  
    fs.readdirSync(config.root+'/server/models/').forEach (file)-&gt;
      @Page = sequelize.import(config.root + '/server/models/' + file)
    @
  </code></pre>
  
  <p>but I have an another problem. How to assign models dynamically?</p>
  
  <p><strong>UPDATED</strong>
  Solved second problem following way:</p>
  
  <pre><code>fs = require("fs")
  Sequelize = require 'sequelize'
  
  module.exports = (config)-&gt;
    @Sequelize = new Sequelize(
      config.database.name
      config.database.username
      config.database.password
      config.database.options
    )
  
    # @Page = sequelize.import(config.root + '/server/models/page')
    fs.readdirSync(config.root+'/server/models/').forEach (file)-&gt;
      str = file.replace('.coffee', '')
      model = str.charAt(0).toUpperCase() + str.slice(1)
      @[model] = @Sequelize.import(config.root + '/server/models/' + file) if ~file.indexOf('.coffee')
    @
  </code></pre>