Skip to content

burketyler/ts-injection

Repository files navigation

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(app.getQuote());
}

Features

About

Dependency injection framework for Typescript NodeJS projects.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors