April 2018
Beginner
536 pages
13h 21m
English
We are going to declare some type bindings. We are going to declare the type bindings using AsyncContainerModule because we need to wait for the database connection to be ready. We are going to declare a binding for MovieRepository. We don't need to declare a binding for the MovieController because the @controller(path) annotation will create it for us. However, we need to import the controller to ensure that the decorator is executed and, as a result, the binding is declared:
import { AsyncContainerModule } from "inversify"; import { Repository, Connection } from "typeorm"; import { Movie } from "./entities/movie"; import { getDbConnection } from "./db"; import { getRepository } from "./repositories/movie_repository"; ...