Skip to main content

Provider

  1. The main idea of a provider is that it can be injected as a dependency;
  2. Controllers should handle HTTP requests and delegate more complex tasks to providers. providers负责处理更复杂的任务。
  3. Many of the basic Nest classes my be treated as a provider - serivces, repositories, factories, helpers, and so on.
  4. Providers注入方式通常使用constructor-based注入,即通常使用基于class的constructor来注入provider。
  5. nest是围绕着Dependency injection这个设计模式建立的。可以通过Angular的一篇文章来了解