Custom Decorators — Basics · NestJS

Write a parameter decorator that hands handlers the current user or one of its properties, and compose role metadata and a guard into one @Auth() decorator.

What you will learn

Read the theory for Custom Decorators

All Basics lessons

All NestJS courses

loading types…

What you'll learn

  • Create a parameter decorator with createParamDecorator and use its data argument to select a property
  • Compose several decorators into one named decorator with applyDecorators
  • Place every stage of the request pipeline in order: middleware, guards, interceptors, pipes, handler, interceptors, filters