UNPKG

875 BTypeScriptView Raw
1import { CanActivate } from '../../interfaces';
2/**
3 * Decorator that binds guards to the scope of the controller or method,
4 * depending on its context.
5 *
6 * When `@UseGuards` is used at the controller level, the guard will be
7 * applied to every handler (method) in the controller.
8 *
9 * When `@UseGuards` is used at the individual handler level, the guard
10 * will apply only to that specific method.
11 *
12 * @param guards a single guard instance or class, or a list of guard instances
13 * or classes.
14 *
15 * @see [Guards](https://docs.nestjs.com/guards)
16 *
17 * @usageNotes
18 * Guards can also be set up globally for all controllers and routes
19 * using `app.useGlobalGuards()`. [See here for details](https://docs.nestjs.com/guards#binding-guards)
20 *
21 * @publicApi
22 */
23export declare function UseGuards(...guards: (CanActivate | Function)[]): MethodDecorator & ClassDecorator;