Check out example codes for "nestjs role guard". It will help you in understanding the concepts better.

Code Example 1

import { Injectable, CanActivate, ExecutionContext } from '@nestjs/common';
import { Observable } from 'rxjs';

@Injectable()
export class RolesGuard implements CanActivate {
  canActivate(
    context: ExecutionContext,
  ): boolean | Promise<boolean> | Observable<boolean> {
    return true;
  }
}

Learn ReactJs, React Native from akashmittal.com