April 2018
Beginner
536 pages
13h 21m
English
The index file is also different. Instead of creating a new Express app, we need to create a new InversifyExpressServer app. The InversifyExpressServer constructor requires an instance of Container. The type bindings for the container are declared in the bindings object, which is an instance of the AsyncContainerModule:
import "reflect-metadata"; import { Container } from "inversify"; import { InversifyExpressServer } from "inversify-express-utils"; import { bindings } from "./inversify.config"; (async () => { const port = 3000; const container = new Container(); await container.loadAsync(bindings); const app = new InversifyExpressServer(container); const server = app.build(); server.listen(port, () => { console.log(`Server running ...