INestMicroservice
Interface describing Microservice Context.
interface INestMicroservice extends INestApplicationContext {
status: Observable<string>
listen(): Promise<any>
useWebSocketAdapter(adapter: WebSocketAdapter<any, any, any>): this
useGlobalFilters(...filters: ExceptionFilter<any>[]): this
useGlobalPipes(...pipes: PipeTransform<any, any>[]): this
useGlobalInterceptors(...interceptors: NestInterceptor<any, any>[]): this
useGlobalGuards(...guards: CanActivate[]): this
close(): Promise<void>
on<EventsMap extends Record<string, Function> = Record<string, Function>, EventKey extends keyof EventsMap = keyof EventsMap, EventCallback extends EventsMap[EventKey] = EventsMap[EventKey]>(event: EventKey, callback: EventCallback): void
unwrap<T>(): T
// inherited from nest/packages/common/INestApplicationContext
select<T>(module: Type<T> | DynamicModule, options?: SelectOptions): INestApplicationContext
get<TInput = any, TResult = TInput>(typeOrToken: string | symbol | Function | Type<TInput>): TResult
resolve<TInput = any, TResult = TInput>(typeOrToken: string | symbol | Function | Type<TInput>): Promise<TResult>
registerRequestByContextId<T = any>(request: T, contextId: { id: number; }): void
close(): Promise<void>
useLogger(logger: false | LoggerService | ("verbose" | "debug" | "log" | "warn" | "error" | "fatal")[]): void
flushLogs(): void
enableShutdownHooks(signals?: string[] | ShutdownSignal[]): this
init(): Promise<this>
}
Properties
Property | Description |
---|---|
status: Observable<string>
|
Returns an observable that emits status changes. |
Methods
listen() |
---|
Starts the microservice. |
ParametersThere are no parameters. Returns
|
useWebSocketAdapter() | ||||||
---|---|---|---|---|---|---|
Registers a web socket adapter that will be used for Gateways.
Use to override the default |
||||||
Parameters
Returns
|
useGlobalFilters() | ||||||
---|---|---|---|---|---|---|
Registers global exception filters (will be used for every pattern handler). |
||||||
Parameters
Returns
|
useGlobalPipes() | ||||||
---|---|---|---|---|---|---|
Registers global pipes (will be used for every pattern handler). |
||||||
Parameters
Returns
|
useGlobalInterceptors() | ||||||
---|---|---|---|---|---|---|
Registers global interceptors (will be used for every pattern handler). |
||||||
Parameters
Returns
|
useGlobalGuards() | ||||||
---|---|---|---|---|---|---|
Registers global guards (will be used for every pattern handler). |
||||||
Parameters
Returns
|
close() |
---|
Terminates the application. |
ParametersThere are no parameters. Returns
|
unwrap() |
---|
Returns an instance of the underlying server/broker instance, or a group of servers if there are more than one. |
ParametersThere are no parameters. Returns
|