0.1.5 • Published 10 years ago

reioc v0.1.5

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

Installation

$ npm install reioc

How to use

You need to configure reioc with rootPath and namespaces. This configuration must be inside app.js top-level file.

require('reioc').config({
    rootPath: __dirname,
    namespaces:{
      // Namespace: { path: path/to/modules/folder }
      services: { path: 'services/test'}
    }
});

var TestService = require('reioc').get('services/testService');

inside /services/test/testService.js:

var TestService = function(settings) {
	this.foo = new TestService.$get['services/fooService']();
};

TestService.$inject = ['services/fooService']; // 'services/' => namespace, 'fooService' => fooService.js, located in 'services' namespace path ({path: 'services/test'}), i.e fooService => services/test/fooService.js
module.exports = TestService;

/services/test/fooService.js:

var FooService = function() {
  // omitted for brevity
};
module.exports = FooService;
0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago