title: How to use dependency injection in typescript?
body: <p>I have tried to add dependency injection in typescript code its working fine .but I need to load express application in dependency injection.</p>
  
  <p><strong>Dependencies.ts</strong>  </p>
  
  <pre><code>import { injectable } from 'inversify';
  
  @injectable()
  export class DependencyA{
      public getName(){
          return "dependencyA"
      }
  }
  
  @injectable()
  export class DependencyB{
      public getName(){
          return "dependencyB"
      }
  }
  </code></pre>
  
  <p><strong>Service.ts</strong>  </p>
  
  <pre><code>import {injectable} from 'inversify';
  import { DependencyA,DependencyB } from './dependencies';
  
  @injectable()
  export class Service{
      dependencya: DependencyA;
      dependencyb: DependencyB;
      constructor(dependencya:DependencyA,dependencyb:DependencyB){
          this.dependencya = dependencya;
          this.dependencyb = dependencyb
  
      }
  
      public getAllName(){
          return this.dependencya
      }
  }
  
  </code></pre>
  
  <p><strong>main.ts</strong>  </p>
  
  <pre><code>import 'reflect-metadata'
  import { Service } from './service';
  import {container} from 'tsyringe';
  
  const service = container.resolve(Service)  
  console.log(service.getAllName)
  
  </code></pre>
  
  <p>how to load the express app in dependency injection and express app pass the parameter in dependency constructor</p>