Injection Scopes — Fundamentals · NestJS

Give a provider one instance per request with the REQUEST token, one per consumer with TRANSIENT and INQUIRER, and see what bubbling does to the classes in between.

What you will learn

Read the theory for Injection Scopes

All Fundamentals lessons

All NestJS courses

loading types…

What you'll learn

  • Declare DEFAULT, REQUEST and TRANSIENT scope, and predict how many instances the container creates
  • Inject the current request into a request-scoped provider with the REQUEST token, and explain why scope bubbles up
  • Inject INQUIRER into a transient provider to learn which class owns it