codejump

Module Internals

Preview — 3 of 10 questions

During bootstrap, what does Nest's DependenciesScanner/compiler do before any provider is instantiated?

AIt executes every controller method once to warm caches
BIt recursively scans modules and their metadata to build a graph of modules, providers, controllers, and their relationships, registering them in the NestContainer
CIt compiles TypeScript to JavaScript on the fly
DIt opens database connections eagerly

What is the key difference between moduleRef.get() and moduleRef.resolve()?

Aget() is async; resolve() is sync
BThey are identical aliases
Cget() retrieves a singleton (DEFAULT-scoped) instance synchronously; resolve() is async and returns a fresh instance for scoped (REQUEST/TRANSIENT) providers, optionally tied to a ContextId
Dresolve() only works for controllers

What role does the MODULE_PATH metadata serve in Nest?

AIt can prefix routes for all controllers within a module (module-level route path), and is part of how Nest associates modules during scanning
BIt sets the file system path for hot reload
CIt defines the npm package name
DIt is the database schema name

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.