Tag
dependency-injection
Published articles tagged dependency-injection.
Dynamic modules in NestJS
forRoot(), forFeature(), and forRootAsync() are how NestJS modules accept options from the application that imports them. This chapter shows what a dynamic module returns, the naming conventions, async configuration through the injector, and generating the boilerplate with ConfigurableModuleBuilder.
Providers and dependency injection in NestJS
Providers hold the work of a Nest application, and the injector decides when to create them and who receives them. This chapter shows how the injector resolves a dependency by token, the four kinds of custom provider, injection scopes, and how to break a circular dependency.