Skip to content

line23/reioc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published