Tuesday 7 February 2017

canister.js - another take on DI in node.js

Hi guys,Bit of a shameless plug but I'm keen to get it out there and hear what the community says.http://ift.tt/2jZ0XXg was built out of the frustration of having to either assemble dependencies manually or having to test using rewire/proxywire which made tests too coupled to implementation. While nodes apps typically tend to be smaller and not as 'object oriented' as their counterparts in other languages, we still believe that SRP applies and testing is generally made easier with test doubles (and that applies to any kind of tests, not only unit/spec).We've been using this lib to quickly bootstrap services that used to have few lines of logic and a lot of boilerplate to fit into our operational endpoint (readiness, health, instrumentation probes etc.). That particular example be found here http://ift.tt/2kJNXJC has been consciously made to be as non-opinionated as possible, hence there is no start/stop functions for system or some other use-case specific solutions.In terms of config there's only yaml and env loaders available, but driving with json/json5 should be easy enough to add if there is interest in doing so.Driving configuration by code is also possible tho a tad verbose ;)Anyway, keen to hear thoughts and would like to invite everybody to try and contribute.Best, Mike

Submitted February 07, 2017 at 06:37PM by thornag

No comments:

Post a Comment