@nestjs/core

  • Version 8.1.1
  • Published
  • 395 kB
  • 7 dependencies
  • MIT license

Install

npm i @nestjs/core
yarn add @nestjs/core
pnpm add @nestjs/core

Overview

Nest - modern, fast, powerful node.js web framework (@core)

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable APP_FILTER

const APP_FILTER: string;

    variable APP_GUARD

    const APP_GUARD: string;

      variable APP_INTERCEPTOR

      const APP_INTERCEPTOR: string;

        variable APP_PIPE

        const APP_PIPE: string;

          variable INQUIRER

          const INQUIRER: string;

            variable NestFactory

            const NestFactory: NestFactoryStatic;
            • Use NestFactory to create an application instance.

              ### Specifying an entry module

              Pass the required *root module* for the application via the module parameter. By convention, it is usually called ApplicationModule. Starting with this module, Nest assembles the dependency graph and begins the process of Dependency Injection and instantiates the classes needed to launch your application.

            variable REQUEST

            const REQUEST: string;

              Functions

              function createContextId

              createContextId: () => ContextId;

                Classes

                class AbstractHttpAdapter

                abstract class AbstractHttpAdapter<TServer = any, TRequest = any, TResponse = any>
                implements HttpServer<TRequest, TResponse> {}

                constructor

                constructor(instance?: any);

                  property httpServer

                  protected httpServer: {};

                    property instance

                    protected instance?: any;

                      method all

                      all: { (handler: any): any; (path: any, handler: any): any };

                        method close

                        abstract close: () => any;

                          method createMiddlewareFactory

                          abstract createMiddlewareFactory: (
                          requestMethod: any
                          ) =>
                          | ((path: string, callback: Function) => any)
                          | Promise<(path: string, callback: Function) => any>;

                            method delete

                            delete: { (handler: any): any; (path: any, handler: any): any };

                              method enableCors

                              abstract enableCors: (
                              options: CorsOptions | CorsOptionsDelegate<TRequest>,
                              prefix?: string
                              ) => any;

                                method get

                                get: { (handler: any): any; (path: any, handler: any): any };

                                  method getHttpServer

                                  getHttpServer: () => TServer;

                                    method getInstance

                                    getInstance: <T = any>() => T;

                                      method getRequestHostname

                                      abstract getRequestHostname: (request: any) => any;

                                        method getRequestMethod

                                        abstract getRequestMethod: (request: any) => any;

                                          method getRequestUrl

                                          abstract getRequestUrl: (request: any) => any;

                                            method getType

                                            abstract getType: () => string;

                                              method head

                                              head: { (handler: any): any; (path: any, handler: any): any };

                                                method init

                                                init: () => Promise<void>;

                                                  method initHttpServer

                                                  abstract initHttpServer: (options: any) => any;

                                                    method listen

                                                    listen: {
                                                    (port: string | number, callback?: () => void): any;
                                                    (port: string | number, hostname: string, callback?: () => void): any;
                                                    };

                                                      method options

                                                      options: { (handler: any): any; (path: any, handler: any): any };

                                                        method patch

                                                        patch: { (handler: any): any; (path: any, handler: any): any };

                                                          method post

                                                          post: { (handler: any): any; (path: any, handler: any): any };

                                                            method put

                                                            put: { (handler: any): any; (path: any, handler: any): any };

                                                              method redirect

                                                              abstract redirect: (response: any, statusCode: number, url: string) => any;

                                                                method registerParserMiddleware

                                                                abstract registerParserMiddleware: (prefix?: string) => any;

                                                                  method render

                                                                  abstract render: (response: any, view: string, options: any) => any;

                                                                    method reply

                                                                    abstract reply: (response: any, body: any, statusCode?: number) => any;

                                                                      method setErrorHandler

                                                                      abstract setErrorHandler: (handler: Function, prefix?: string) => any;

                                                                        method setHeader

                                                                        abstract setHeader: (response: any, name: string, value: string) => any;

                                                                          method setHttpServer

                                                                          setHttpServer: (httpServer: TServer) => void;

                                                                            method setInstance

                                                                            setInstance: <T = any>(instance: T) => void;

                                                                              method setNotFoundHandler

                                                                              abstract setNotFoundHandler: (handler: Function, prefix?: string) => any;

                                                                                method setViewEngine

                                                                                abstract setViewEngine: (engine: string) => any;

                                                                                  method status

                                                                                  abstract status: (response: any, statusCode: number) => any;

                                                                                    method use

                                                                                    use: (...args: any[]) => any;

                                                                                      method useStaticAssets

                                                                                      abstract useStaticAssets: (...args: any[]) => any;

                                                                                        class ApplicationConfig

                                                                                        class ApplicationConfig {}

                                                                                          constructor

                                                                                          constructor(ioAdapter?: any);

                                                                                            method addGlobalFilter

                                                                                            addGlobalFilter: (filter: any) => void;

                                                                                              method addGlobalGuard

                                                                                              addGlobalGuard: (guard: any) => void;

                                                                                                method addGlobalInterceptor

                                                                                                addGlobalInterceptor: (interceptor: any) => void;

                                                                                                  method addGlobalPipe

                                                                                                  addGlobalPipe: (pipe: any) => void;

                                                                                                    method addGlobalRequestFilter

                                                                                                    addGlobalRequestFilter: (wrapper: InstanceWrapper<ExceptionFilter>) => void;

                                                                                                      method addGlobalRequestGuard

                                                                                                      addGlobalRequestGuard: (wrapper: InstanceWrapper<CanActivate>) => void;

                                                                                                        method addGlobalRequestInterceptor

                                                                                                        addGlobalRequestInterceptor: (wrapper: InstanceWrapper<NestInterceptor>) => void;

                                                                                                          method addGlobalRequestPipe

                                                                                                          addGlobalRequestPipe: (wrapper: InstanceWrapper<PipeTransform>) => void;

                                                                                                            method enableVersioning

                                                                                                            enableVersioning: (options: any) => void;

                                                                                                              method getGlobalFilters

                                                                                                              getGlobalFilters: () => ExceptionFilter[];

                                                                                                                method getGlobalGuards

                                                                                                                getGlobalGuards: () => CanActivate[];

                                                                                                                  method getGlobalInterceptors

                                                                                                                  getGlobalInterceptors: () => NestInterceptor[];

                                                                                                                    method getGlobalPipes

                                                                                                                    getGlobalPipes: () => PipeTransform<any>[];

                                                                                                                      method getGlobalPrefix

                                                                                                                      getGlobalPrefix: () => string;

                                                                                                                        method getGlobalPrefixOptions

                                                                                                                        getGlobalPrefixOptions: () => any;

                                                                                                                          method getGlobalRequestFilters

                                                                                                                          getGlobalRequestFilters: () => InstanceWrapper<ExceptionFilter>[];

                                                                                                                            method getGlobalRequestGuards

                                                                                                                            getGlobalRequestGuards: () => InstanceWrapper<CanActivate>[];

                                                                                                                              method getGlobalRequestInterceptors

                                                                                                                              getGlobalRequestInterceptors: () => InstanceWrapper<NestInterceptor>[];

                                                                                                                                method getGlobalRequestPipes

                                                                                                                                getGlobalRequestPipes: () => InstanceWrapper<PipeTransform>[];

                                                                                                                                  method getIoAdapter

                                                                                                                                  getIoAdapter: () => any;

                                                                                                                                    method getVersioning

                                                                                                                                    getVersioning: () => VersioningOptions | undefined;

                                                                                                                                      method setGlobalPrefix

                                                                                                                                      setGlobalPrefix: (prefix: string) => void;

                                                                                                                                        method setGlobalPrefixOptions

                                                                                                                                        setGlobalPrefixOptions: (options: any) => void;

                                                                                                                                          method setIoAdapter

                                                                                                                                          setIoAdapter: (ioAdapter: any) => void;

                                                                                                                                            method useGlobalFilters

                                                                                                                                            useGlobalFilters: (...filters: ExceptionFilter[]) => void;

                                                                                                                                              method useGlobalGuards

                                                                                                                                              useGlobalGuards: (...guards: CanActivate[]) => void;

                                                                                                                                                method useGlobalInterceptors

                                                                                                                                                useGlobalInterceptors: (...interceptors: NestInterceptor[]) => void;

                                                                                                                                                  method useGlobalPipes

                                                                                                                                                  useGlobalPipes: (...pipes: PipeTransform<any>[]) => void;

                                                                                                                                                    class BaseExceptionFilter

                                                                                                                                                    class BaseExceptionFilter<T = any> implements ExceptionFilter<T> {}

                                                                                                                                                      constructor

                                                                                                                                                      constructor(applicationRef?: any);

                                                                                                                                                        property applicationRef

                                                                                                                                                        protected readonly applicationRef?: any;

                                                                                                                                                          property httpAdapterHost

                                                                                                                                                          protected readonly httpAdapterHost?: HttpAdapterHost<
                                                                                                                                                          AbstractHttpAdapter<any, any, any>
                                                                                                                                                          >;

                                                                                                                                                            method catch

                                                                                                                                                            catch: (exception: T, host: any) => void;

                                                                                                                                                              method handleUnknownError

                                                                                                                                                              handleUnknownError: (
                                                                                                                                                              exception: T,
                                                                                                                                                              host: any,
                                                                                                                                                              applicationRef: AbstractHttpAdapter | HttpServer
                                                                                                                                                              ) => void;

                                                                                                                                                                method isExceptionObject

                                                                                                                                                                isExceptionObject: (err: any) => err is Error;

                                                                                                                                                                  method isHttpError

                                                                                                                                                                  isHttpError: (err: any) => err is { statusCode: number; message: string };
                                                                                                                                                                  • Checks if the thrown error comes from the "http-errors" library.

                                                                                                                                                                    Parameter err

                                                                                                                                                                    error object

                                                                                                                                                                  class ContextIdFactory

                                                                                                                                                                  class ContextIdFactory {}

                                                                                                                                                                    method create

                                                                                                                                                                    static create: () => ContextId;
                                                                                                                                                                    • Generates a context identifier based on the request object.

                                                                                                                                                                    method getByRequest

                                                                                                                                                                    static getByRequest: <T extends Record<any, any> = any>(request: T) => ContextId;
                                                                                                                                                                    • Generates a random identifier to track asynchronous execution context.

                                                                                                                                                                      Parameter request

                                                                                                                                                                      request object

                                                                                                                                                                    class DiscoveryModule

                                                                                                                                                                    class DiscoveryModule {}

                                                                                                                                                                    class DiscoveryService

                                                                                                                                                                    class DiscoveryService {}

                                                                                                                                                                    constructor

                                                                                                                                                                    constructor(modulesContainer: ModulesContainer);

                                                                                                                                                                      method getControllers

                                                                                                                                                                      getControllers: (
                                                                                                                                                                      options?: DiscoveryOptions,
                                                                                                                                                                      modules?: Module[]
                                                                                                                                                                      ) => InstanceWrapper[];

                                                                                                                                                                        method getModules

                                                                                                                                                                        protected getModules: (options?: DiscoveryOptions) => Module[];

                                                                                                                                                                          method getProviders

                                                                                                                                                                          getProviders: (
                                                                                                                                                                          options?: DiscoveryOptions,
                                                                                                                                                                          modules?: Module[]
                                                                                                                                                                          ) => InstanceWrapper[];

                                                                                                                                                                            class HttpAdapterHost

                                                                                                                                                                            class HttpAdapterHost<T extends AbstractHttpAdapter = AbstractHttpAdapter> {}
                                                                                                                                                                            • Defines the HttpAdapterHost object.

                                                                                                                                                                              HttpAdapterHost wraps the underlying platform-specific HttpAdapter. The HttpAdapter is a wrapper around the underlying native HTTP server library (e.g., Express). The HttpAdapterHost object provides methods to get and set the underlying HttpAdapter.

                                                                                                                                                                              See Also

                                                                                                                                                                              • [Http adapter](https://docs.nestjs.com/faq/http-adapter)

                                                                                                                                                                            property httpAdapter

                                                                                                                                                                            httpAdapter: AbstractHttpAdapter<any, any, any>;
                                                                                                                                                                            • Accessor for the underlying HttpAdapter

                                                                                                                                                                              Example 1

                                                                                                                                                                              const httpAdapter = adapterHost.httpAdapter;

                                                                                                                                                                            class LazyModuleLoader

                                                                                                                                                                            class LazyModuleLoader {}

                                                                                                                                                                              constructor

                                                                                                                                                                              constructor(
                                                                                                                                                                              dependenciesScanner: DependenciesScanner,
                                                                                                                                                                              instanceLoader: InstanceLoader,
                                                                                                                                                                              moduleCompiler: ModuleCompiler,
                                                                                                                                                                              modulesContainer: ModulesContainer
                                                                                                                                                                              );

                                                                                                                                                                                method load

                                                                                                                                                                                load: (
                                                                                                                                                                                loaderFn: () =>
                                                                                                                                                                                | Promise<Type<unknown> | DynamicModule>
                                                                                                                                                                                | Type<unknown>
                                                                                                                                                                                | DynamicModule
                                                                                                                                                                                ) => Promise<ModuleRef>;

                                                                                                                                                                                  class MetadataScanner

                                                                                                                                                                                  class MetadataScanner {}

                                                                                                                                                                                    method getAllFilteredMethodNames

                                                                                                                                                                                    getAllFilteredMethodNames: (prototype: object) => IterableIterator<string>;

                                                                                                                                                                                      method scanFromPrototype

                                                                                                                                                                                      scanFromPrototype: <T extends any, R = any>(
                                                                                                                                                                                      instance: T,
                                                                                                                                                                                      prototype: object,
                                                                                                                                                                                      callback: (name: string) => R
                                                                                                                                                                                      ) => R[];

                                                                                                                                                                                        class MiddlewareBuilder

                                                                                                                                                                                        class MiddlewareBuilder implements MiddlewareConsumer {}

                                                                                                                                                                                          constructor

                                                                                                                                                                                          constructor(routesMapper: RoutesMapper, httpAdapter: any);

                                                                                                                                                                                            method apply

                                                                                                                                                                                            apply: (...middleware: Array<Type<any> | Function | any>) => any;

                                                                                                                                                                                              method build

                                                                                                                                                                                              build: () => MiddlewareConfiguration[];

                                                                                                                                                                                                method getHttpAdapter

                                                                                                                                                                                                getHttpAdapter: () => any;

                                                                                                                                                                                                  class ModuleRef

                                                                                                                                                                                                  abstract class ModuleRef {}

                                                                                                                                                                                                    constructor

                                                                                                                                                                                                    constructor(container: NestContainer);

                                                                                                                                                                                                      property container

                                                                                                                                                                                                      protected readonly container: NestContainer;

                                                                                                                                                                                                        method create

                                                                                                                                                                                                        abstract create: <T = any>(type: any) => Promise<T>;

                                                                                                                                                                                                          method find

                                                                                                                                                                                                          protected find: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                          typeOrToken: Type<TInput> | string | symbol,
                                                                                                                                                                                                          contextModule?: Module
                                                                                                                                                                                                          ) => TResult;

                                                                                                                                                                                                            method get

                                                                                                                                                                                                            abstract get: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                            typeOrToken: Type<TInput> | string | symbol,
                                                                                                                                                                                                            options?: { strict: boolean }
                                                                                                                                                                                                            ) => TResult;

                                                                                                                                                                                                              method instantiateClass

                                                                                                                                                                                                              protected instantiateClass: <T = any>(
                                                                                                                                                                                                              type: any,
                                                                                                                                                                                                              moduleRef: Module
                                                                                                                                                                                                              ) => Promise<T>;

                                                                                                                                                                                                                method introspect

                                                                                                                                                                                                                introspect: <T = any>(token: Type<T> | string | symbol) => any;

                                                                                                                                                                                                                  method registerRequestByContextId

                                                                                                                                                                                                                  registerRequestByContextId: <T = any>(request: T, contextId: ContextId) => void;

                                                                                                                                                                                                                    method resolve

                                                                                                                                                                                                                    abstract resolve: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                                    typeOrToken: Type<TInput> | string | symbol,
                                                                                                                                                                                                                    contextId?: ContextId,
                                                                                                                                                                                                                    options?: { strict: boolean }
                                                                                                                                                                                                                    ) => Promise<TResult>;

                                                                                                                                                                                                                      method resolvePerContext

                                                                                                                                                                                                                      protected resolvePerContext: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                                      typeOrToken: Type<TInput> | string | symbol,
                                                                                                                                                                                                                      contextModule: Module,
                                                                                                                                                                                                                      contextId: ContextId,
                                                                                                                                                                                                                      options?: { strict: boolean }
                                                                                                                                                                                                                      ) => Promise<TResult>;

                                                                                                                                                                                                                        class ModulesContainer

                                                                                                                                                                                                                        class ModulesContainer extends Map<string, Module> {}

                                                                                                                                                                                                                          property applicationId

                                                                                                                                                                                                                          readonly applicationId: string;

                                                                                                                                                                                                                            class NestApplication

                                                                                                                                                                                                                            class NestApplication extends NestApplicationContext implements INestApplication {}

                                                                                                                                                                                                                            constructor

                                                                                                                                                                                                                            constructor(
                                                                                                                                                                                                                            container: NestContainer,
                                                                                                                                                                                                                            httpAdapter: any,
                                                                                                                                                                                                                            config: ApplicationConfig,
                                                                                                                                                                                                                            appOptions?: any
                                                                                                                                                                                                                            );

                                                                                                                                                                                                                              method applyOptions

                                                                                                                                                                                                                              applyOptions: () => void;

                                                                                                                                                                                                                                method connectMicroservice

                                                                                                                                                                                                                                connectMicroservice: <T extends object>(
                                                                                                                                                                                                                                microserviceOptions: T,
                                                                                                                                                                                                                                hybridAppOptions?: any
                                                                                                                                                                                                                                ) => any;

                                                                                                                                                                                                                                  method createServer

                                                                                                                                                                                                                                  createServer: <T = any>() => T;

                                                                                                                                                                                                                                    method dispose

                                                                                                                                                                                                                                    protected dispose: () => Promise<void>;

                                                                                                                                                                                                                                      method enableCors

                                                                                                                                                                                                                                      enableCors: (options?: CorsOptions | CorsOptionsDelegate<any>) => void;

                                                                                                                                                                                                                                        method enableVersioning

                                                                                                                                                                                                                                        enableVersioning: (options?: any) => this;

                                                                                                                                                                                                                                          method getHttpAdapter

                                                                                                                                                                                                                                          getHttpAdapter: () => AbstractHttpAdapter;

                                                                                                                                                                                                                                            method getHttpServer

                                                                                                                                                                                                                                            getHttpServer: () => any;

                                                                                                                                                                                                                                              method getMicroservices

                                                                                                                                                                                                                                              getMicroservices: () => INestMicroservice[];

                                                                                                                                                                                                                                                method getUnderlyingHttpServer

                                                                                                                                                                                                                                                getUnderlyingHttpServer: <T>() => T;

                                                                                                                                                                                                                                                  method getUrl

                                                                                                                                                                                                                                                  getUrl: () => Promise<string>;

                                                                                                                                                                                                                                                    method init

                                                                                                                                                                                                                                                    init: () => Promise<this>;

                                                                                                                                                                                                                                                      method listen

                                                                                                                                                                                                                                                      listen: {
                                                                                                                                                                                                                                                      (port: number | string): Promise<any>;
                                                                                                                                                                                                                                                      (port: string | number, hostname: string): Promise<any>;
                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                        method listenAsync

                                                                                                                                                                                                                                                        listenAsync: (port: number | string, ...args: any[]) => Promise<any>;

                                                                                                                                                                                                                                                          method registerHttpServer

                                                                                                                                                                                                                                                          registerHttpServer: () => void;

                                                                                                                                                                                                                                                            method registerModules

                                                                                                                                                                                                                                                            registerModules: () => Promise<void>;

                                                                                                                                                                                                                                                              method registerParserMiddleware

                                                                                                                                                                                                                                                              registerParserMiddleware: () => void;

                                                                                                                                                                                                                                                                method registerRouter

                                                                                                                                                                                                                                                                registerRouter: () => Promise<void>;

                                                                                                                                                                                                                                                                  method registerRouterHooks

                                                                                                                                                                                                                                                                  registerRouterHooks: () => Promise<void>;

                                                                                                                                                                                                                                                                    method registerWsModule

                                                                                                                                                                                                                                                                    registerWsModule: () => void;

                                                                                                                                                                                                                                                                      method setBaseViewsDir

                                                                                                                                                                                                                                                                      setBaseViewsDir: (path: string | string[]) => this;

                                                                                                                                                                                                                                                                        method setGlobalPrefix

                                                                                                                                                                                                                                                                        setGlobalPrefix: (prefix: string, options?: any) => this;

                                                                                                                                                                                                                                                                          method setViewEngine

                                                                                                                                                                                                                                                                          setViewEngine: (engineOrOptions: any) => this;

                                                                                                                                                                                                                                                                            method startAllMicroservices

                                                                                                                                                                                                                                                                            startAllMicroservices: () => Promise<this>;

                                                                                                                                                                                                                                                                              method startAllMicroservicesAsync

                                                                                                                                                                                                                                                                              startAllMicroservicesAsync: () => Promise<this>;

                                                                                                                                                                                                                                                                                method use

                                                                                                                                                                                                                                                                                use: (args_0: any, args_1?: any) => this;

                                                                                                                                                                                                                                                                                  method useGlobalFilters

                                                                                                                                                                                                                                                                                  useGlobalFilters: (...filters: ExceptionFilter[]) => this;

                                                                                                                                                                                                                                                                                    method useGlobalGuards

                                                                                                                                                                                                                                                                                    useGlobalGuards: (...guards: CanActivate[]) => this;

                                                                                                                                                                                                                                                                                      method useGlobalInterceptors

                                                                                                                                                                                                                                                                                      useGlobalInterceptors: (...interceptors: NestInterceptor[]) => this;

                                                                                                                                                                                                                                                                                        method useGlobalPipes

                                                                                                                                                                                                                                                                                        useGlobalPipes: (...pipes: PipeTransform<any>[]) => this;

                                                                                                                                                                                                                                                                                          method useStaticAssets

                                                                                                                                                                                                                                                                                          useStaticAssets: { (options: any): this; (path: string, options?: any): this };

                                                                                                                                                                                                                                                                                            method useWebSocketAdapter

                                                                                                                                                                                                                                                                                            useWebSocketAdapter: (adapter: any) => this;

                                                                                                                                                                                                                                                                                              class NestApplicationContext

                                                                                                                                                                                                                                                                                              class NestApplicationContext implements INestApplicationContext {}

                                                                                                                                                                                                                                                                                              constructor

                                                                                                                                                                                                                                                                                              constructor(container: NestContainer, scope?: any[], contextModule?: Module);

                                                                                                                                                                                                                                                                                                property container

                                                                                                                                                                                                                                                                                                protected readonly container: NestContainer;

                                                                                                                                                                                                                                                                                                  property injector

                                                                                                                                                                                                                                                                                                  protected readonly injector: Injector;

                                                                                                                                                                                                                                                                                                    property isInitialized

                                                                                                                                                                                                                                                                                                    protected isInitialized: boolean;

                                                                                                                                                                                                                                                                                                      method callBeforeShutdownHook

                                                                                                                                                                                                                                                                                                      protected callBeforeShutdownHook: (signal?: string) => Promise<void>;
                                                                                                                                                                                                                                                                                                      • Calls the beforeApplicationShutdown function on the registered modules and children.

                                                                                                                                                                                                                                                                                                      method callBootstrapHook

                                                                                                                                                                                                                                                                                                      protected callBootstrapHook: () => Promise<void>;
                                                                                                                                                                                                                                                                                                      • Calls the onApplicationBootstrap function on the registered modules and its children.

                                                                                                                                                                                                                                                                                                      method callDestroyHook

                                                                                                                                                                                                                                                                                                      protected callDestroyHook: () => Promise<void>;
                                                                                                                                                                                                                                                                                                      • Calls the onModuleDestroy function on the registered modules and its children.

                                                                                                                                                                                                                                                                                                      method callInitHook

                                                                                                                                                                                                                                                                                                      protected callInitHook: () => Promise<void>;
                                                                                                                                                                                                                                                                                                      • Calls the onModuleInit function on the registered modules and its children.

                                                                                                                                                                                                                                                                                                      method callShutdownHook

                                                                                                                                                                                                                                                                                                      protected callShutdownHook: (signal?: string) => Promise<void>;
                                                                                                                                                                                                                                                                                                      • Calls the onApplicationShutdown function on the registered modules and children.

                                                                                                                                                                                                                                                                                                      method close

                                                                                                                                                                                                                                                                                                      close: () => Promise<void>;

                                                                                                                                                                                                                                                                                                        method dispose

                                                                                                                                                                                                                                                                                                        protected dispose: () => Promise<void>;

                                                                                                                                                                                                                                                                                                          method enableShutdownHooks

                                                                                                                                                                                                                                                                                                          enableShutdownHooks: (signals?: (ShutdownSignal | string)[]) => this;
                                                                                                                                                                                                                                                                                                          • Enables the usage of shutdown hooks. Will call the onApplicationShutdown function of a provider if the process receives a shutdown signal.

                                                                                                                                                                                                                                                                                                            Parameter signals

                                                                                                                                                                                                                                                                                                            The system signals it should listen to

                                                                                                                                                                                                                                                                                                            Returns

                                                                                                                                                                                                                                                                                                            {this} The Nest application context instance

                                                                                                                                                                                                                                                                                                          method find

                                                                                                                                                                                                                                                                                                          protected find: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                                                                                                                          typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
                                                                                                                                                                                                                                                                                                          contextModule?: Module
                                                                                                                                                                                                                                                                                                          ) => TResult;

                                                                                                                                                                                                                                                                                                            method flushLogs

                                                                                                                                                                                                                                                                                                            flushLogs: () => void;

                                                                                                                                                                                                                                                                                                              method get

                                                                                                                                                                                                                                                                                                              get: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                                                                                                                              typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
                                                                                                                                                                                                                                                                                                              options?: { strict: boolean }
                                                                                                                                                                                                                                                                                                              ) => TResult;

                                                                                                                                                                                                                                                                                                                method init

                                                                                                                                                                                                                                                                                                                init: () => Promise<this>;
                                                                                                                                                                                                                                                                                                                • Initalizes the Nest application. Calls the Nest lifecycle events.

                                                                                                                                                                                                                                                                                                                  Returns

                                                                                                                                                                                                                                                                                                                  {Promise} The NestApplicationContext instance as Promise

                                                                                                                                                                                                                                                                                                                method listenToShutdownSignals

                                                                                                                                                                                                                                                                                                                protected listenToShutdownSignals: (signals: string[]) => void;
                                                                                                                                                                                                                                                                                                                • Listens to shutdown signals by listening to process events

                                                                                                                                                                                                                                                                                                                  Parameter signals

                                                                                                                                                                                                                                                                                                                  The system signals it should listen to

                                                                                                                                                                                                                                                                                                                method registerRequestByContextId

                                                                                                                                                                                                                                                                                                                registerRequestByContextId: <T = any>(request: T, contextId: ContextId) => void;

                                                                                                                                                                                                                                                                                                                  method resolve

                                                                                                                                                                                                                                                                                                                  resolve: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                                                                                                                                  typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
                                                                                                                                                                                                                                                                                                                  contextId?: ContextId,
                                                                                                                                                                                                                                                                                                                  options?: { strict: boolean }
                                                                                                                                                                                                                                                                                                                  ) => Promise<TResult>;

                                                                                                                                                                                                                                                                                                                    method resolvePerContext

                                                                                                                                                                                                                                                                                                                    protected resolvePerContext: <TInput = any, TResult = TInput>(
                                                                                                                                                                                                                                                                                                                    typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
                                                                                                                                                                                                                                                                                                                    contextModule: Module,
                                                                                                                                                                                                                                                                                                                    contextId: ContextId,
                                                                                                                                                                                                                                                                                                                    options?: { strict: boolean }
                                                                                                                                                                                                                                                                                                                    ) => Promise<TResult>;

                                                                                                                                                                                                                                                                                                                      method select

                                                                                                                                                                                                                                                                                                                      select: <T>(moduleType: Type<T> | DynamicModule) => any;

                                                                                                                                                                                                                                                                                                                        method selectContextModule

                                                                                                                                                                                                                                                                                                                        selectContextModule: () => void;

                                                                                                                                                                                                                                                                                                                          method unsubscribeFromProcessSignals

                                                                                                                                                                                                                                                                                                                          protected unsubscribeFromProcessSignals: () => void;
                                                                                                                                                                                                                                                                                                                          • Unsubscribes from shutdown signals (process events)

                                                                                                                                                                                                                                                                                                                          method useLogger

                                                                                                                                                                                                                                                                                                                          useLogger: (logger: LoggerService | LogLevel[] | false) => void;

                                                                                                                                                                                                                                                                                                                            class NestContainer

                                                                                                                                                                                                                                                                                                                            class NestContainer {}

                                                                                                                                                                                                                                                                                                                              constructor

                                                                                                                                                                                                                                                                                                                              constructor(_applicationConfig?: ApplicationConfig);

                                                                                                                                                                                                                                                                                                                                property applicationConfig

                                                                                                                                                                                                                                                                                                                                readonly applicationConfig: ApplicationConfig;

                                                                                                                                                                                                                                                                                                                                  method addController

                                                                                                                                                                                                                                                                                                                                  addController: (controller: any, token: string) => void;

                                                                                                                                                                                                                                                                                                                                    method addDynamicMetadata

                                                                                                                                                                                                                                                                                                                                    addDynamicMetadata: (
                                                                                                                                                                                                                                                                                                                                    token: string,
                                                                                                                                                                                                                                                                                                                                    dynamicModuleMetadata: any,
                                                                                                                                                                                                                                                                                                                                    scope: Type<any>[]
                                                                                                                                                                                                                                                                                                                                    ) => Promise<void>;

                                                                                                                                                                                                                                                                                                                                      method addDynamicModules

                                                                                                                                                                                                                                                                                                                                      addDynamicModules: (modules: any[], scope: Type<any>[]) => Promise<void>;

                                                                                                                                                                                                                                                                                                                                        method addExportedProvider

                                                                                                                                                                                                                                                                                                                                        addExportedProvider: (provider: any, token: string) => void;

                                                                                                                                                                                                                                                                                                                                          method addGlobalModule

                                                                                                                                                                                                                                                                                                                                          addGlobalModule: (module: Module) => void;

                                                                                                                                                                                                                                                                                                                                            method addImport

                                                                                                                                                                                                                                                                                                                                            addImport: (
                                                                                                                                                                                                                                                                                                                                            relatedModule: Type<any> | DynamicModule,
                                                                                                                                                                                                                                                                                                                                            token: string
                                                                                                                                                                                                                                                                                                                                            ) => Promise<void>;

                                                                                                                                                                                                                                                                                                                                              method addInjectable

                                                                                                                                                                                                                                                                                                                                              addInjectable: (injectable: any, token: string, host?: any) => void;

                                                                                                                                                                                                                                                                                                                                                method addModule

                                                                                                                                                                                                                                                                                                                                                addModule: (
                                                                                                                                                                                                                                                                                                                                                metatype: Type<any> | DynamicModule | Promise<DynamicModule>,
                                                                                                                                                                                                                                                                                                                                                scope: Type<any>[]
                                                                                                                                                                                                                                                                                                                                                ) => Promise<Module | undefined>;

                                                                                                                                                                                                                                                                                                                                                  method addProvider

                                                                                                                                                                                                                                                                                                                                                  addProvider: (provider: any, token: string) => string | symbol | Function;

                                                                                                                                                                                                                                                                                                                                                    method bindGlobalModuleToModule

                                                                                                                                                                                                                                                                                                                                                    bindGlobalModuleToModule: (target: Module, globalModule: Module) => void;

                                                                                                                                                                                                                                                                                                                                                      method bindGlobalScope

                                                                                                                                                                                                                                                                                                                                                      bindGlobalScope: () => void;

                                                                                                                                                                                                                                                                                                                                                        method bindGlobalsToImports

                                                                                                                                                                                                                                                                                                                                                        bindGlobalsToImports: (moduleRef: Module) => void;

                                                                                                                                                                                                                                                                                                                                                          method clear

                                                                                                                                                                                                                                                                                                                                                          clear: () => void;

                                                                                                                                                                                                                                                                                                                                                            method getDynamicMetadataByToken

                                                                                                                                                                                                                                                                                                                                                            getDynamicMetadataByToken: (
                                                                                                                                                                                                                                                                                                                                                            token: string,
                                                                                                                                                                                                                                                                                                                                                            metadataKey: keyof DynamicModule
                                                                                                                                                                                                                                                                                                                                                            ) => any[];

                                                                                                                                                                                                                                                                                                                                                              method getHttpAdapterHostRef

                                                                                                                                                                                                                                                                                                                                                              getHttpAdapterHostRef: () => import('..').HttpAdapterHost<
                                                                                                                                                                                                                                                                                                                                                              import('..').AbstractHttpAdapter<any, any, any>
                                                                                                                                                                                                                                                                                                                                                              >;

                                                                                                                                                                                                                                                                                                                                                                method getHttpAdapterRef

                                                                                                                                                                                                                                                                                                                                                                getHttpAdapterRef: () => import('..').AbstractHttpAdapter<any, any, any>;

                                                                                                                                                                                                                                                                                                                                                                  method getInternalCoreModuleRef

                                                                                                                                                                                                                                                                                                                                                                  getInternalCoreModuleRef: () => Module | undefined;

                                                                                                                                                                                                                                                                                                                                                                    method getModuleByKey

                                                                                                                                                                                                                                                                                                                                                                    getModuleByKey: (moduleKey: string) => Module;

                                                                                                                                                                                                                                                                                                                                                                      method getModuleCompiler

                                                                                                                                                                                                                                                                                                                                                                      getModuleCompiler: () => ModuleCompiler;

                                                                                                                                                                                                                                                                                                                                                                        method getModules

                                                                                                                                                                                                                                                                                                                                                                        getModules: () => ModulesContainer;

                                                                                                                                                                                                                                                                                                                                                                          method getModuleTokenFactory

                                                                                                                                                                                                                                                                                                                                                                          getModuleTokenFactory: () => ModuleTokenFactory;

                                                                                                                                                                                                                                                                                                                                                                            method isGlobalModule

                                                                                                                                                                                                                                                                                                                                                                            isGlobalModule: (metatype: any, dynamicMetadata?: any) => boolean;

                                                                                                                                                                                                                                                                                                                                                                              method registerCoreModuleRef

                                                                                                                                                                                                                                                                                                                                                                              registerCoreModuleRef: (moduleRef: Module) => void;

                                                                                                                                                                                                                                                                                                                                                                                method registerRequestProvider

                                                                                                                                                                                                                                                                                                                                                                                registerRequestProvider: <T = any>(request: T, contextId: ContextId) => void;

                                                                                                                                                                                                                                                                                                                                                                                  method replace

                                                                                                                                                                                                                                                                                                                                                                                  replace: (toReplace: any, options: any & { scope: any[] | null }) => void;

                                                                                                                                                                                                                                                                                                                                                                                    method setHttpAdapter

                                                                                                                                                                                                                                                                                                                                                                                    setHttpAdapter: (httpAdapter: any) => void;

                                                                                                                                                                                                                                                                                                                                                                                      class Reflector

                                                                                                                                                                                                                                                                                                                                                                                      class Reflector {}
                                                                                                                                                                                                                                                                                                                                                                                      • Helper class providing Nest reflection capabilities.

                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                        • [Reflection](https://docs.nestjs.com/guards#putting-it-all-together)

                                                                                                                                                                                                                                                                                                                                                                                      method get

                                                                                                                                                                                                                                                                                                                                                                                      get: <TResult = any, TKey = any>(
                                                                                                                                                                                                                                                                                                                                                                                      metadataKey: TKey,
                                                                                                                                                                                                                                                                                                                                                                                      target: Type<any> | Function
                                                                                                                                                                                                                                                                                                                                                                                      ) => TResult;
                                                                                                                                                                                                                                                                                                                                                                                      • Retrieve metadata for a specified key for a specified target.

                                                                                                                                                                                                                                                                                                                                                                                        Parameter metadataKey

                                                                                                                                                                                                                                                                                                                                                                                        lookup key for metadata to retrieve

                                                                                                                                                                                                                                                                                                                                                                                        Parameter target

                                                                                                                                                                                                                                                                                                                                                                                        context (decorated object) to retrieve metadata from

                                                                                                                                                                                                                                                                                                                                                                                        Example 1

                                                                                                                                                                                                                                                                                                                                                                                        const roles = this.reflector.get<string[]>('roles', context.getHandler());

                                                                                                                                                                                                                                                                                                                                                                                      method getAll

                                                                                                                                                                                                                                                                                                                                                                                      getAll: <TResult extends any[] = any[], TKey = any>(
                                                                                                                                                                                                                                                                                                                                                                                      metadataKey: TKey,
                                                                                                                                                                                                                                                                                                                                                                                      targets: (Type<any> | Function)[]
                                                                                                                                                                                                                                                                                                                                                                                      ) => TResult;
                                                                                                                                                                                                                                                                                                                                                                                      • Retrieve metadata for a specified key for a specified set of targets.

                                                                                                                                                                                                                                                                                                                                                                                        Parameter metadataKey

                                                                                                                                                                                                                                                                                                                                                                                        lookup key for metadata to retrieve

                                                                                                                                                                                                                                                                                                                                                                                        Parameter targets

                                                                                                                                                                                                                                                                                                                                                                                        context (decorated objects) to retrieve metadata from

                                                                                                                                                                                                                                                                                                                                                                                      method getAllAndMerge

                                                                                                                                                                                                                                                                                                                                                                                      getAllAndMerge: <TResult extends any[] = any[], TKey = any>(
                                                                                                                                                                                                                                                                                                                                                                                      metadataKey: TKey,
                                                                                                                                                                                                                                                                                                                                                                                      targets: (Type<any> | Function)[]
                                                                                                                                                                                                                                                                                                                                                                                      ) => TResult;
                                                                                                                                                                                                                                                                                                                                                                                      • Retrieve metadata for a specified key for a specified set of targets and merge results.

                                                                                                                                                                                                                                                                                                                                                                                        Parameter metadataKey

                                                                                                                                                                                                                                                                                                                                                                                        lookup key for metadata to retrieve

                                                                                                                                                                                                                                                                                                                                                                                        Parameter targets

                                                                                                                                                                                                                                                                                                                                                                                        context (decorated objects) to retrieve metadata from

                                                                                                                                                                                                                                                                                                                                                                                      method getAllAndOverride

                                                                                                                                                                                                                                                                                                                                                                                      getAllAndOverride: <TResult = any, TKey = any>(
                                                                                                                                                                                                                                                                                                                                                                                      metadataKey: TKey,
                                                                                                                                                                                                                                                                                                                                                                                      targets: (Type<any> | Function)[]
                                                                                                                                                                                                                                                                                                                                                                                      ) => TResult;
                                                                                                                                                                                                                                                                                                                                                                                      • Retrieve metadata for a specified key for a specified set of targets and return a first not undefined value.

                                                                                                                                                                                                                                                                                                                                                                                        Parameter metadataKey

                                                                                                                                                                                                                                                                                                                                                                                        lookup key for metadata to retrieve

                                                                                                                                                                                                                                                                                                                                                                                        Parameter targets

                                                                                                                                                                                                                                                                                                                                                                                        context (decorated objects) to retrieve metadata from

                                                                                                                                                                                                                                                                                                                                                                                      class RouterModule

                                                                                                                                                                                                                                                                                                                                                                                      class RouterModule {}

                                                                                                                                                                                                                                                                                                                                                                                      constructor

                                                                                                                                                                                                                                                                                                                                                                                      constructor(modulesContainer: ModulesContainer, routes: Routes);

                                                                                                                                                                                                                                                                                                                                                                                        method register

                                                                                                                                                                                                                                                                                                                                                                                        static register: (routes: Routes) => any;

                                                                                                                                                                                                                                                                                                                                                                                          Interfaces

                                                                                                                                                                                                                                                                                                                                                                                          interface ContextId

                                                                                                                                                                                                                                                                                                                                                                                          interface ContextId {}

                                                                                                                                                                                                                                                                                                                                                                                            property id

                                                                                                                                                                                                                                                                                                                                                                                            readonly id: number;

                                                                                                                                                                                                                                                                                                                                                                                              interface DiscoveryOptions

                                                                                                                                                                                                                                                                                                                                                                                              interface DiscoveryOptions {}

                                                                                                                                                                                                                                                                                                                                                                                              property include

                                                                                                                                                                                                                                                                                                                                                                                              include?: Function[];

                                                                                                                                                                                                                                                                                                                                                                                                interface RouteTree

                                                                                                                                                                                                                                                                                                                                                                                                interface RouteTree {}

                                                                                                                                                                                                                                                                                                                                                                                                  property children

                                                                                                                                                                                                                                                                                                                                                                                                  children?: Routes | Type<any>[];

                                                                                                                                                                                                                                                                                                                                                                                                    property module

                                                                                                                                                                                                                                                                                                                                                                                                    module?: Type<any>;

                                                                                                                                                                                                                                                                                                                                                                                                      property path

                                                                                                                                                                                                                                                                                                                                                                                                      path: string;

                                                                                                                                                                                                                                                                                                                                                                                                        Type Aliases

                                                                                                                                                                                                                                                                                                                                                                                                        type Routes

                                                                                                                                                                                                                                                                                                                                                                                                        type Routes = RouteTree[];

                                                                                                                                                                                                                                                                                                                                                                                                          Package Files (24)

                                                                                                                                                                                                                                                                                                                                                                                                          Dependencies (7)

                                                                                                                                                                                                                                                                                                                                                                                                          Dev Dependencies (1)

                                                                                                                                                                                                                                                                                                                                                                                                          Peer Dependencies (6)

                                                                                                                                                                                                                                                                                                                                                                                                          Badge

                                                                                                                                                                                                                                                                                                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/core.

                                                                                                                                                                                                                                                                                                                                                                                                          • Markdown
                                                                                                                                                                                                                                                                                                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@nestjs/core)
                                                                                                                                                                                                                                                                                                                                                                                                          • HTML
                                                                                                                                                                                                                                                                                                                                                                                                            <a href="https://www.jsdocs.io/package/@nestjs/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>