IS_PUBLIC_KEY
The metadata key set by the @Public() decorator. Use this constant in guards to detect whether a controller or handler has been marked as public.
import { IS_PUBLIC_KEY } from '@opra/nestjs';
Value
const IS_PUBLIC_KEY = 'opra:isPublic';
Usage in a guard
import { IS_PUBLIC_KEY } from '@opra/nestjs';
import { Reflector } from '@nestjs/core';
const isPublic = this.reflector.getAllAndOverride<boolean>(IS_PUBLIC_KEY, [
context.getHandler(),
context.getClass(),
]);