Execution Context — Fundamentals · NestJS

Put metadata on a class as the default and on handlers as the override, mark handlers public with SetMetadata, and read it all in a global guard with getAllAndOverride.

What you will learn

Read the theory for Execution Context

All Fundamentals lessons

All NestJS courses

loading types…

What you'll learn

  • Tell ArgumentsHost from ExecutionContext, and know what getType(), getArgs(), getHandler() and getClass() give
  • Write a metadata decorator with SetMetadata and read it with the Reflector by key, next to one made with Reflector.createDecorator
  • Merge class-level and handler-level metadata with getAllAndOverride, and register a global guard under APP_GUARD