ts-injection
v3.2.0
Published
Dependency injection framework for Typescript/Javascript NodeJS applications.
Downloads
13
Maintainers
Readme
ts-injection is an annotation based dependency injection framework written in Typescript for NodeJS apps. It enables building applications that have loosely coupled components.
Show me some code
@Injectable()
class ArnyService {
public getQuote(): string {
return "Get to the choppa!";
}
}
@Injectable()
class ArnyApp {
@Autowire(ArnyService)
private service!: ArnyService;
public getQuote(): string {
return this.service.getQuote();
}
}
const container = new InjectionContainer();
function main(): void {
const app = container.resolve(ArnyApp);
console.log(handler.getQuote());
}
Features
- 🌾 Field injection
- 🔨 Constructor injection
- 🔢 Environment variable parsing
View full documentation