{"_id":"service-container","_rev":"31-7b095f899bbbb15b224ef9909dc60fe6","name":"service-container","dist-tags":{"latest":"0.0.11"},"versions":{"0.0.1":{"name":"service-container","version":"0.0.1","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.1","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"d6ff0527c07550adc3a1dc895adc356e135138ce","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.1.tgz","integrity":"sha512-BcjMMIRL8MNmk0w8FZrIRUioaSgPVcUru4Vq26uDsEjlNGv3T/5+YBobQGAUgEU1yn4f8QSWyFnwqNeAcZv19g==","signatures":[{"sig":"MEUCIG3ioAhq2djNLqvGTINpM93pA4fgdw4MqYQJDsb7i9PEAiEA+wbuy9jkxIT4AQaMGDN0JSyavd2jZCeu/wsi2ybMGys=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/ServiceContainer","_from":"./","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"http://github.com/linkshare/service-container/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.25","description":"","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.2":{"name":"service-container","version":"0.0.2","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.2","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"2f4db3e4d588a99214d0a59386bc00efda3785c0","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.2.tgz","integrity":"sha512-MSHqJl41CrzMz3uiZyfeqWFJnYnL3p90yOEKWFB23RyJSy1b1VWQL4o100Cofwl+g8AgXOKeb7Iq2aDZHeK8EQ==","signatures":[{"sig":"MEUCIQC7Zj4uDxfp6l9wSgAJ3I8m3B3ATZyQQ2irnBjwlLqrxAIgeXScDbjGL74Bgd2gpA+P6hV9yCPAl+I/0Ub/bPkccSY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/ServiceContainer","_from":"./","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"http://github.com/linkshare/service-container/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.25","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.3":{"name":"service-container","version":"0.0.3","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.3","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"e04b8e90a5fb53bea52fa4b6ceafcf32c930d77d","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.3.tgz","integrity":"sha512-t3r0epgGYXWcUaam+iTyl8lpS7i7z/xpE8U/BmtNKK/J6k3gKpXRSbFhW4osKTaFb4fBlOUVoosl/22/fkO59g==","signatures":[{"sig":"MEUCIA+pioIr/SHIKIin0rkzxAX35KI/+UtFNlT23uZGArNdAiEAzxM2XtbwVag4KBQRndzZKhl6YnRxV87JEyFu7fOgAPA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/ServiceContainer","_from":"./","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"http://github.com/linkshare/service-container/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.25","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.4":{"name":"service-container","version":"0.0.4","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.4","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"dist":{"shasum":"4ea159cc65cb1a32faf9de6bcf33860a8357aad5","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.4.tgz","integrity":"sha512-a2fyC5HgO4TbmGE1QU3vryQvASwmq1cxFqLY7gdDjvuIC5HFbcDsE9aX93+UGgCQRgJcPcIfORToHQxVrqXHgg==","signatures":[{"sig":"MEYCIQCqxo0A490yEo0wUsiL1DPKQ3kXA/H7Yq+KdUA/EpeT6QIhAI4/y7f1uSboWrYLPFhEafcsD7QLpl1902uWV4m41cad","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/ServiceContainer","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.0","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.5":{"name":"service-container","version":"0.0.5","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.5","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"dist":{"shasum":"c8bea28c073049de6cd0cf6ca24ad606f5b18e80","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.5.tgz","integrity":"sha512-H7CScbVlVhF/E4CmmNYDGKVmShVH5q7EB0Io3f82T6uSzJZyKf85vcmy0FIpJh9jVaikfdKYO5KI7OcUOaAQ1A==","signatures":[{"sig":"MEQCIF7XeY2rJtxj4B+SGQIsIfWmbHaju/oXYXiIL3AYrW6LAiAGXiEQ3cW3viuuGZ9dvJ/RLf14xKCzPi+zcTrB4F2vwQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/ServiceContainer","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.0","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.6":{"name":"service-container","version":"0.0.6","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.6","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"dist":{"shasum":"8a973baf067bd222f74858178e31a0ef04737f7d","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.6.tgz","integrity":"sha512-vHmupG5XZnvIWInE8E1zGaL5wK73v5VGBw5Eo1TeMVTOfBlXJgoO7/xFE0JAkipCaUOyx5I6AATvhMw5tOdqpA==","signatures":[{"sig":"MEUCIQDenBZ1OIGtpSBUMeWqbpueDEtcOchZq/Mc0G8CTkk3NwIgEvo1tEEaBiE1dK9AOZ272kc12RYO9EQxIeR0S6zEJe4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"ServiceContainer.js","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.0","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.7":{"name":"service-container","version":"0.0.7","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.7","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"dist":{"shasum":"78e123f4cb4d2f61f6ed7d109ef8555bf6ebc453","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.7.tgz","integrity":"sha512-wxsD5/EBXQQh50t1I9IZiO37/8c7JJewi60yz9ybV0IYdKW6foKrq3WzvbXfvF317xI4cI3NtAvH+gEuShdiEA==","signatures":[{"sig":"MEYCIQDmP7HhWlWGA+qb5kO/deSeurnrgXIFI64URY+OmCsjJAIhAL3SLo2P0ZKbPvAF10uaiFVuDcBCfh86Qx8yXF6fPAhn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"ServiceContainer.js","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.2.0","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.8":{"name":"service-container","version":"0.0.8","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.8","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"22094ddb628feae487446d699eccb4dca5b0c33b","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.8.tgz","integrity":"sha512-xekFWHt8n0h2XaBp3aw+RkSAZ0x2dDNevuPvEXqT/TVjXhdE8nzl3rg4vN66fGJHQYYWBBkxjyVHVP9ThNqQIw==","signatures":[{"sig":"MEUCIDSMGwDAc6TFgwRnJG5SJrVyvO0tYsP2VXtQRViMPFHbAiEA7FGcnAd0mYn95UhXaLnqfe00TIEr34aUfOiIBRXtJ5I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"ServiceContainer.js","_from":".","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.3.2","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.9":{"name":"service-container","version":"0.0.9","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.9","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"eb54efcb86505957cf0bd3177c625a681ef8ee59","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.9.tgz","integrity":"sha512-NHGjXHcySIEbljSzn7gmBVsoQpGJbJYCJ2w4mNYWDIY+nZ5I8X4HoWBV4jJB3rfkYmpG7KqBqWT6GWumIS4QhQ==","signatures":[{"sig":"MEQCIEzNcuAkeJ9Trz4cAOi5C31+EmEq/mclS69oL3M3Mav2AiAiCSba1iszCX8Iuvn9j2FBZU8zcP3uLqULMl11ExkwKw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"ServiceContainer.js","_from":"./","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.3.2","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.10":{"name":"service-container","version":"0.0.10","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.10","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"fffc588bf682ee1072443b6e349c85732a2e05a0","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.10.tgz","integrity":"sha512-PYuVN1i94r+pKzKFOYBpBW3vpO7cDblsSw8C8OPB0BV7Nv5skxpegAdM1ntwogs05GI9DsfzPYxw+Hz9WBSfRA==","signatures":[{"sig":"MEUCIQD98w5TAZGXUUUA1/fqH7ziAkETZu3Q/rpJygIz789nCQIgNka7kqZjyJrrLTiqtnJ7fqHA3jyuCW+LBj7JA5qXLGE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"ServiceContainer.js","_from":"./","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.3.11","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}},"0.0.11":{"name":"service-container","version":"0.0.11","author":{"name":"Brandon Eum"},"_id":"service-container@0.0.11","maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"contributors":[],"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"dist":{"shasum":"3b5540d063f45a5c6794f83826226c24bed75c13","tarball":"https://registry.npmjs.org/service-container/-/service-container-0.0.11.tgz","integrity":"sha512-czMZHJVcDJDyQLVL/az9x0LRCt7S92oMhnZ7XonPE1HGuS+w3NSOvJYOyw0NB0seZospzo6keFdydJSDetq8fA==","signatures":[{"sig":"MEYCIQDQY2vM+UMsQmszPT6R2zkwe1cEyCrsrywSKoGThC9ksQIhALXMIoFt+NZ92x1owqu2YAW63r5vqD+X++m8MUMKKCZq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"ServiceContainer.js","_from":".","engines":{"node":">=0.8.17"},"_npmUser":{"name":"beum","email":"brandoneum@gmail.com"},"licenses":[{"url":"https://github.com/linkshare/service-container/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"_npmVersion":"1.3.11","description":"A Symfony2 inspired depdendency injection container for node","directories":{"lib":"./lib","example":"./example"},"dependencies":{},"devDependencies":{"chai":"latest","mocha":"latest","sinon":"latest","spears":"git://github.com/beum/spears-js.git","jscoverage":"latest"}}},"time":{"created":"2013-07-05T05:04:37.161Z","modified":"2025-10-19T23:42:04.122Z","0.0.1":"2013-07-05T05:04:38.618Z","0.0.2":"2013-07-05T05:09:45.640Z","0.0.3":"2013-07-05T05:24:11.529Z","0.0.4":"2013-07-08T21:42:30.128Z","0.0.5":"2013-07-09T14:02:33.559Z","0.0.6":"2013-07-09T15:50:54.101Z","0.0.7":"2013-07-09T19:01:53.932Z","0.0.8":"2013-07-18T13:01:33.142Z","0.0.9":"2013-09-13T19:38:37.198Z","0.0.10":"2013-12-05T17:24:13.746Z","0.0.11":"2014-05-15T20:43:41.298Z"},"bugs":{"url":"https://github.com/linkshare/service-container/issues"},"author":{"name":"Brandon Eum"},"repository":{"url":"git://github.com/linkshare/service-container.git","type":"git"},"description":"A Symfony2 inspired depdendency injection container for node","contributors":[],"maintainers":[{"name":"beum","email":"brandoneum@gmail.com"}],"readme":"# Service Container\n\n\nA Symfony2-style dependency injection library for Node.js\n\n# Purpose\n\n\nInspired by the [Symfony2 Service Container](http://fabien.potencier.org/article/13/introduction-to-the-symfony-service-container)\n\nA service container increases the usability of classes by allowing a configuration\nfile to specify which classes should be used to construct a class.  The container\nwill construct an instance of the class for you using the parameters that you\nspecify, allowing you to specify different classes to use in different situations\nor different environments.\n\nFor example, if you have a class that makes HTTP requests.  In your production\nenvironment you would want this to be a real http client.  In your unit test\nenvironment, there is significant complication and overhead in using a real HTTP\nclient, so you would probably want to use a mock class instead that delivers canned\nand predictable responses.\n\nWith a service container, you can reconfigure your class through a configuration\nfile without actually touching your code.\n\nThe Symfony 2 Guide Book provides a great [explanation](http://symfony.com/doc/current/book/service_container.html)\n\n\n# Installation\n\n\n    npm install service-container\n\nOr add to your package.json dependencies.\n\n\n# Usage\n\nThere are two pieces to using the service container, the container itself and the\n`services.json` configuration files.\n\nThe `services.json` file specifies [3 types of dependency injection](http://symfony.com/doc/current/components/dependency_injection/types.html):\n* Constructor Injection\n* Setter Injection\n* Property Injection\n\nConstructor injection allows you to specify JSON literal parameters as arguments\nfor your class instances or it will allow you to specify another service as an\nargument (be careful about circular dependencies!).\n\nSetter injection will attempt to call the method that you specify with the arguments\n(either parameters or other services) that you define.  This is useful for adding\ndependency injection for existing libraries that do not conform to Constructor\nInjection.\n\nProperty injection will directly attempt to set the property on the object with\nthe argument that you specify, either another service or a JSON literal parameter.\n\n\n## Initializing and using the container\n\nCreate a container like:\n\n```javascript\nvar ServiceContainer = require('service-container');\n\n// Create an instance of the container with the environment option set\n// This will include both services.json and services_[ENV].json files to override\n// any environment-specific parameters\nvar options = {\n  env: 'test',\n  ignoreNodeModulesDirectory: true\n};\nvar container = ServiceContainer.buildContainer(__dirname, options);\n```\n\nThere are two available options:\n* `env` - Which will cause the builder to search for `services_[ENV].json` files\n* `ignoreNodeModulesDirectory` - Which will prevent a recursive search through your dependent modules\n\n\nGet an instance of a service like:\n\n```javascript\n// Get an example mailer service\nvar mailer = container.get('mailer');\nmailer.sendMail('Hello');\n\n// Get a parameter\nvar maxcount = container.getParameter('mailer.maxcount');\n```\n\nThe section below goes over how to configure and construct services.\n\n## services.json\n\nWhen initializing the container, you'll pass it the root directory for it to search\nfor the services.json files.  The Builder will recursively search through directories\nbelow the root directory to search for services.json files.  If the `env` option\nis specified then files named services_[ENV].json will also be parsed.  Allowing\nyou to override any parameters setup earlier.\n\nThe hierarchy of services and parameters are as follows:\n* services.json files at lower folder levels are overridden by those at higher levels\n* services.json files are overriden by services_[ENV].json files\n* parameters are loaded and overriden by any parameters in the parameters.json file (see below)\n\nThis allows you to override the specifics of a module from the application level\nand allows you to override any parameter based on whether this is your dev, test,\nqa or production environment.\n\n```javascript\n{\n  \"parameters\": {\n    \"dependency_service.file\":\"./CoolClass\",   // File paths are relative to the services.json file\n    \"dependency2_service.file\":\"./OtherClass\",\n    \"my_service.file\":\"MyClass\",\n    \"my_service.example_param\":\"yes\",          // Parameter names are arbitrary\n    \"my_service.obj_param\":{isExample: true}   // Can use literals as parameters\n  },\n  \"services\": {\n    \"dependency_service\": {\n      \"class\":\"%depency_service.file%\",\n      \"arguments\":[]  // No Arguments\n    },\n    \"dependency2_service\": {\n      \"class\":\"%depency2_service.file%\",\n      \"arguments\":[]\n    },\n    \"my_service\": {\n      \"class\":\"%my_service.file%\" // Parameters use % symbols, services use @\n      \"arguments\": [\"@dependency_service\", \"%my_service.example_param%\", \"@?optional_service\"] // Optional services have @? at the beginning\n      \"calls\": [\n        [\"setSecondDependency\", [\"@dependency2_service\"]] // Method calls have the method name and an array of arguments\n      ],\n      \"properties\": {\n        \"myServiceProperty\":\"%my_service.obj_param%\"\n      }\n    }\n  }\n}\n```\n\n### Other Service Options\n\n* `\"constructorMethod\"` - A specific constructor function if including a library that\n  serves as a namespace for many constructors.  For example: `mylibrary.SomeClass`\n  the constructorMethod would be \"SomeClass\".\n* `\"isObject\"` - When including a service that is an object and not a constructor\n  like the node module `fs`\n* `\"isSingleton\"` - Create only one of these objects as a service which will be\n  passed around everytime the service is called.  The default behavior is that\n  new objects will be created everytime the user requests this service from the\n  container.\n\n\n### parameters.json\n\nThe service container will also load its configurations through files named\n`paramters.json`.  Only the parameters block is loaded from these files and they\noverride any previously seen parameters.  This file is specifically meant to be\nout of version control and maintain deployment-specific details such as a DB user\nand password, or the log level of a specific environment, etc.  These are details\nthat should be configured on the server level manually or through your configuration\nmanager.\n\n\n### Importing Other JSON Service Configuration Files\n\nTo support more complex service.json file organizations, the `\"imports\"` key allows\nany JSON file to be parsed like a services.json file.  In terms of service and parameter\nhierarchy, the imports are at the same level as the file that they are found in.\nThe imports are parsed top to bottom, and are all overridden by whatever content\nis in the services.json file.\n\n\n```javascript\n{\n  \"imports\": [\n    \"../my_other_services.json\",\n    \"./lib/stuff.json\"\n  ],\n  \"parameters\": {\n    // ...\n  },\n  \"services\": {\n    // ...\n  }\n}\n```\n\n\n### Namespaces\n\nIn addition to imports, another key feature for a complex application is the\nuse of namespaces.  Within any of your `services.json` files, you can apply a\nnamespace which will be prefixed to all of the paramters and services defined\nin that file.  In addition, the namespace will be prepended to any files that\nare imported via a name-spaced file and if they have their own namespace, it\nwill be applied after the namespace from the importing file.\n\nAll of the references within a `services.json` file using a namespace will prefer\nparameters and services using that namespace and if no matching parameter or\nservice can be found, it will graduate to the non-namespaced version of the\nservice or parameter name.\n\nSo for example:\n\n```javascript\n{\n  \"namespace\": \"api_models.v2\",\n  \"parameters\": {\n    \"user.class\": \"./User.js\"\n  },\n  \"services\": {\n    \"user\": {\"class\": \"%user.class%\"}\n  }\n}\n```\n\nIn the example above, you would actually retrieve the user service from the\ncontainer by including the namespace:\n\n    var User = container.get('api_models.v2.user');\n\nAnd although the user class is specified by `user.class`, it will actually\nlook up the parameter named `api_models.v2.user.class` first, and if that is\nnot found, it will use the parameter `user.class`.\n\n\n## Examples\n\nCheck out the `example` directory to see some of the more common use cases for a\nservice container.\n\nIncluded:\n* Basic usage\n* Overriding/Using mocks with the environment option\n* Using an argument as a service\n\n\n##TODO\n* tags\n* scoped services\n\n## Run the Tests\n\n    make unittest\n\n## Create Unit Test Coverage\n\n    make coverage\n\nOpen the file `coverage.html` that gets generated in the root directory\n","readmeFilename":"README.md","users":{"sixpaq":true}}