View on GitHub

coredi

Dependency Injection library for Node.js and Browser

Service loaders

If you need create new service, you need create service loader.

Service loader is simple js object, which contains information about dependencies for this service, default configuration, name, create and fork functions

Service loader:

{
    name: 'serviceName',
    requires: ['someService'],
    config: {
        param: 'value',
    }
    async create(container) {
        const someService = container('someService');
    }
}

Service loader definition