@david.uhlir/services
TypeScript icon, indicating that this package has built-in type declarations

2.0.9 • Public • Published

Services util for server applications

This utility is some kind of dependency injection, but it's really simple. It's provided by decorators, and it's assign reference to instance of service to variable. To initialize your context (where services will be initialized) just call something. like this:

import { ServicesContext } from '@david.uhlir/services';

ServicesContext.initialize([
    new TestService1(),
    new TestService2(),
]);

Usage

import { Service } from '@david.uhlir/services';
import { TestService2 } from './TestService2';

export class TestService1 extends Service {
    @ServicesContext.inject(TestService2)
    protected service: TestService2;
}

ISC

Package Sidebar

Install

npm i @david.uhlir/services

Weekly Downloads

225

Version

2.0.9

License

ISC

Unpacked Size

42.3 kB

Total Files

47

Last publish

Collaborators

  • david.uhlir