May be Dependency
Injection
http://www.joezimjs.com/javascript/dependency-injection-with-javascript/
is the an answer?
Create you module as object and send mongoose instance as parameter to
constructor.
Meettya.
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.c
You can try something like this.
In *~/projects/app/web.js:*
var mongoose = require('mongoose'), mymodule = require('mymodule');
mymodule.mongoose = mongoose.
// followed by configuration of the mongoose instance
In *~/projects/mymodule/index.js:*
exports.mongoose = null;
// needs to be the sam
Thanks for the suggestions guys, I'm going with a similar approach to
Floby's suggection and making it possible to provide mongoose to mymodule
for development (whereas in production it will inherit from the parent
project).
On Wednesday, July 3, 2013 1:29:51 PM UTC+10, j...@team9.com.au wrote:
You can also try to make use of module.parent.require() function and
module.parent.parent.(...).parent.require() to get dependencies using
context of modules that required current module.
On Tuesday, July 9, 2013 7:58:47 AM UTC+4, j...@team9.com.au wrote:
>
> Thanks for the suggestions guys, I