The piece I'm still missing is, how do I inject modules I didn't write? For instance, how would I inject 'fs' or 'http'? Or perhaps 'request'?
-- Martin Cooper On Thu, Apr 25, 2013 at 12:04 PM, Scott Corgan <[email protected]>wrote: > Put together a quick blog post describing the problem I am solving and the > "why" behind Injector: http://sctt.cc/6Mue > > > On Saturday, April 20, 2013 10:19:27 AM UTC-7, 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.
