DI Containers with InversifyJS
Register and resolve services with a container.
Why a DI Container?
Manually wiring large object graphs is tedious and error-prone. A DI container registers how to build each dependency and resolves them automatically. InversifyJS is a popular TypeScript container.
Installing and Enabling
InversifyJS relies on decorators and reflection metadata. You import from inversify and enable experimentalDecorators plus reflect-metadata.
import "reflect-metadata";
import { Container, injectable, inject } from "inversify";All lessons in this course
- Inversion of Control Basics
- Constructor Injection
- DI Containers with InversifyJS
- Type-Safe Service Tokens