This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

ninject

0.2.0 • Public • Published

ninject

Node Dependency Injection

var config = require('ninject')('config');

init

Should be run in your application's entry point before any require statements.

require('ninject').init(options);

  • options
    • K/V pairs where the key is the require name and the value is the path to the file.
    • The path is from the file where you have initialised.
//ProjectRoot
// |-example.js 
// |-config.js
// |-Controllers
//   |-home.js
//   |-account.js


var options = {
  config: './config',
  HomeController: './Controllers/home',
  AccountController: './Controllers/account'
}

require('ninject').init(options);
//...the rest of your startup can continue now...

register

External registrations can be made once the init has run by performing a register.

require('ninject').register(packageName, packagePath);

  • packageName - the name to use when ninjecting
  • packagePath - The path to the package.

Readme

Keywords

Package Sidebar

Install

npm i ninject

Weekly Downloads

0

Version

0.2.0

License

ISC

Last publish

Collaborators

  • tonytamps