Coding task · NestJS course · Module 2: Routing and Request Lifecycle

@Roles() Decorator with SetMetadata and RolesGuard

Create a @Roles() decorator and a guard that reads roles from metadata.

Task

Write a @Roles() decorator using SetMetadata('roles', roles) and a RolesGuard with Reflector that checks user roles