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

Basics: RolesGuard with Metadata

Create a guard that checks user roles based on metadata.

Task

Write a RolesGuard that uses Reflector to read roles from SetMetadata and compare them with the user's role