UNPKG

4.26 kBTypeScriptView Raw
1import { ScopeOptions } from '../../interfaces/scope-options.interface';
2/**
3 * Interface defining options that can be passed to `@Controller()` decorator
4 *
5 * @publicApi
6 */
7export interface ControllerOptions extends ScopeOptions {
8 /**
9 * Specifies an optional `route path prefix`. The prefix is pre-pended to the
10 * path specified in any request decorator in the class.
11 *
12 * @see [Routing](https://docs.nestjs.com/controllers#routing)
13 */
14 path?: string | string[];
15 /**
16 * Specifies an optional HTTP Request host filter. When configured, methods
17 * within the controller will only be routed if the request host matches the
18 * specified value.
19 *
20 * @see [Routing](https://docs.nestjs.com/controllers#routing)
21 */
22 host?: string | string[];
23}
24/**
25 * Decorator that marks a class as a Nest controller that can receive inbound
26 * requests and produce responses.
27 *
28 * An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
29 * It defines a class that provides the context for one or more related route
30 * handlers that correspond to HTTP request methods and associated routes
31 * for example `GET /api/profile`, `POST /user/resume`.
32 *
33 * A Microservice Controller responds to requests as well as events, running over
34 * a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
35 * It defines a class that provides a context for one or more message or event
36 * handlers.
37 *
38 * @see [Controllers](https://docs.nestjs.com/controllers)
39 * @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
40 *
41 * @publicApi
42 */
43export declare function Controller(): ClassDecorator;
44/**
45 * Decorator that marks a class as a Nest controller that can receive inbound
46 * requests and produce responses.
47 *
48 * An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
49 * It defines a class that provides the context for one or more related route
50 * handlers that correspond to HTTP request methods and associated routes
51 * for example `GET /api/profile`, `POST /user/resume`.
52 *
53 * A Microservice Controller responds to requests as well as events, running over
54 * a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
55 * It defines a class that provides a context for one or more message or event
56 * handlers.
57 *
58 * @param {string, Array} prefix string that defines a `route path prefix`. The prefix
59 * is pre-pended to the path specified in any request decorator in the class.
60 *
61 * @see [Routing](https://docs.nestjs.com/controllers#routing)
62 * @see [Controllers](https://docs.nestjs.com/controllers)
63 * @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
64 *
65 * @publicApi
66 */
67export declare function Controller(prefix: string | string[]): ClassDecorator;
68/**
69 * Decorator that marks a class as a Nest controller that can receive inbound
70 * requests and produce responses.
71 *
72 * An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
73 * It defines a class that provides the context for one or more related route
74 * handlers that correspond to HTTP request methods and associated routes
75 * for example `GET /api/profile`, `POST /user/resume`.
76 *
77 * A Microservice Controller responds to requests as well as events, running over
78 * a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
79 * It defines a class that provides a context for one or more message or event
80 * handlers.
81 *
82 * @param {object} options configuration object specifying:
83 *
84 * - `scope` - symbol that determines the lifetime of a Controller instance.
85 * [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
86 * more details.
87 * - `prefix` - string that defines a `route path prefix`. The prefix
88 * is pre-pended to the path specified in any request decorator in the class.
89 *
90 * @see [Routing](https://docs.nestjs.com/controllers#routing)
91 * @see [Controllers](https://docs.nestjs.com/controllers)
92 * @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
93 *
94 * @publicApi
95 */
96export declare function Controller(options: ControllerOptions): ClassDecorator;