Question · NestJS course · Module 2: Routing and Request Lifecycle

SetMetadata and Reflector

What is the SetMetadata() function used for in NestJS?

Answer options

  • Sets HTTP response headers
  • Assigns metadata to a method/class, read later by Reflector
  • Creates a new REST endpoint
  • Defines the database schema
Show the answer

Correct answer:

  • Assigns metadata to a method/class, read later by Reflector