On Wednesday, November 14, 2012 at 6:46 PM, Ken Koontz wrote: > Thanks for the help. I'm now having problems with the export. In app.js I > export db. In the other module I attempt to use it. > > https://gist.github.com/4076308 > > When I require db the variable is undefined. Any suggestions? Modules are loaded synchronously but I'm guessing your database setup is asynchronous (i.e. done using a callback). You should rewrite the app module in such a way that you're exporting a function that takes a callback, and that callback gets called with the db object as a parameter once it's available. You could also take a look at using something like Cloud9's architect (https://github.com/c9/architect) or flatiron's broadway (https://github.com/flatiron/broadway) to help manage dependencies by treating them like plugins.
F -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
