Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion understanding module.export

Received: by 10.42.47.137 with SMTP id o9mr18025027icf.6.1352943707854;
        Wed, 14 Nov 2012 17:41:47 -0800 (PST)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.50.15.169 with SMTP id y9ls170709igc.30.canary; Wed, 14 Nov
 2012 17:41:32 -0800 (PST)
Received: by 10.50.10.165 with SMTP id j5mr534662igb.0.1352943692430;
        Wed, 14 Nov 2012 17:41:32 -0800 (PST)
Date: Wed, 14 Nov 2012 17:41:32 -0800 (PST)
From: Ken Koontz <kenneth.koo...@gmail.com>
To: nodejs@googlegroups.com
Message-Id: <f32beaa7-c2b6-42db-b200-88cb982b3db4@googlegroups.com>
Subject: understanding module.export
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_45_27447364.1352943692018"

------=_Part_45_27447364.1352943692018
Content-Type: multipart/alternative; 
	boundary="----=_Part_46_1522654.1352943692018"

------=_Part_46_1522654.1352943692018
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

I am working on an express app. I've separated my route logic outside of 
the app.js file, which I'm using for config. I'm trying to configure my db 
in app.js and export this into any route module that needs it.

Here is my db code that i'm pulling into app.js.

db file snippet
https://gist.github.com/4076060

app.js file snippet
https://gist.github.com/4076065

The output from console.log(db); in the app.js file appears to be an empty 
object. However, when I reference a function such as console.log(db.create) 
it returns [ Function ]. Why does console.log(db) return {} and not 
something like {create: [ Function ].....}


------=_Part_46_1522654.1352943692018
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

I am working on an express app. I've separated my route logic outside of the app.js file, which I'm using for config. I'm trying to configure my db in app.js and export this into any route module that needs it.<div><br></div><div>Here is my db code that i'm pulling into app.js.</div><div><br></div><div>db file snippet</div><div>https://gist.github.com/4076060<br></div><div><br></div><div>app.js file snippet</div><div>https://gist.github.com/4076065<br></div><div><br></div><div>The output from console.log(db); in the app.js file appears to be an empty object. However, when I reference a function such as console.log(db.create) it returns [ Function ]. Why does console.log(db) return {} and not something like {create: [ Function ].....}</div><div><br></div>
------=_Part_46_1522654.1352943692018--

------=_Part_45_27447364.1352943692018--