INestApplicationContext
Interface defining NestApplicationContext.
interface 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 | LogLevel[]): void
flushLogs(): void
enableShutdownHooks(signals?: string[] | ShutdownSignal[]): this
init(): Promise<this>
}
Child interfaces
Methods
select() | |||||||||
---|---|---|---|---|---|---|---|---|---|
Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module. |
|||||||||
Parameters
Returns |
get() | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves an instance of either injectable or controller, otherwise, throws exception. |
|||||||||||||||||||||||||||
3 overloads...Show All Hide All expand_moreOverload #1
Parameters
Returns
Overload #2Retrieves a list of instances of either injectables or controllers, otherwise, throws exception.
Parameters
Returns
Overload #3Retrieves an instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
Parameters
Returns
|
resolve() | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception. |
|||||||||||||||||||||||||||||||||||||||||||||
4 overloads...Show All Hide All expand_moreOverload #1
Parameters
Returns
Overload #2
Parameters
Returns
Overload #3Resolves transient or request-scoped instances of either injectables or controllers, otherwise, throws exception.
Parameters
Returns
Overload #4Resolves transient or request-scoped instance (or a list of instances) of either injectable or controller, otherwise, throws exception.
Parameters
Returns
|
registerRequestByContextId() |
---|
Registers the request/context object for a given context ID (DI container sub-tree). |
close() |
---|
Terminates the application |
ParametersThere are no parameters. Returns
|
useLogger() | ||||||
---|---|---|---|---|---|---|
Sets custom logger service. Flushes buffered logs if auto flush is on. |
||||||
Parameters
Returns
|
flushLogs() |
---|
Prints buffered logs and detaches buffer. |
ParametersThere are no parameters. Returns
|
enableShutdownHooks() | ||||||
---|---|---|---|---|---|---|
Enables the usage of shutdown hooks. Will call the
|
||||||
Parameters
Returns
|
init() |
---|
Initializes the Nest application. Calls the Nest lifecycle events. It isn't mandatory to call this method directly. |
ParametersThere are no parameters. Returns
|