Not to thread hijack, but we have been using this for a while where I work: github.com/idottv/dependable
It expects a single function to be exported in module.exports. It looks at the names of the parameters and then resolves the dependencies either based on what you have registered manually or in directories you have registered. On Thu, Apr 25, 2013 at 9:10 AM, Scott Corgan <[email protected]> wrote: > Hi Paul, > > I've set up a small and quick example on the repo. You can view the > example here: http://sctt.cc/Ae7c > > Let me know if you need any help with it. > > > On Wednesday, April 24, 2013 7:03:41 AM UTC-7, Paul Spaulding wrote: >> >> Cool. Could you post a complete example, not just fragments? >> >> On Saturday, April 20, 2013 1:19:27 PM UTC-4, Scott Corgan wrote: >>> >>> Not sure what kind of backlash I'll get for doing things slightly >>> different than the "Node" way, but I wrote what I believe is the easiest >>> and lightest solution I've seen for dependency injection for Node. >>> >>> It's call Injector <https://github.com/scottcorgan/Injector> ( >>> https://github.com/**scottcorgan/Injector<https://github.com/scottcorgan/Injector> >>> ) >>> >>> The idea is that you add a comment at the top of the file "// inject", >>> then these files are automatically loaded and ready for injection. I've >>> found it MUCH easier to inject mocks for tests. Also, when using this >>> module, directory structure is only for visual organization for the coder. >>> No need to worry about where the file is located, especially if you move >>> the file to a different directory. Normally I'd just use another module, >>> but I didn't find anything that was just easy. A lot of how the injection >>> works is based off of the AngularJS source code. >>> >>> Anyways, would love some feedback. Always looking to improve the coding >>> experience for developers. >>> >> -- > -- > 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 > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
