News for hackers. Stuff that matters.
Re:Your first Node.js module by smagch on Monday May 28, 2012 @04:57AM (#4032545)
I usually use just `module.export = {...}` in the bottom line when I want to export object by object literal.

To be honest, I'm not quite sure about commonJS require implementation of nodeJS. But as long as I'm understand,

1. Use `module.exports` if you want to assign exports by object literal

2. Use `exports.[key]` if you want to assign exports brick by brick.

3. Use `exports = module.exports = {...}` or `module.exports = exports` if you want to ensure both functionality; you can assign `exports.[key] after assign exports by object literal.

There are no comments on this comment yet.