common

Entry point exports

Classes

BadGatewayException

Defines an HTTP exception for Bad Gateway type errors.

BadRequestException

Defines an HTTP exception for Bad Request type errors.

ConfigurableModuleBuilder

Factory that lets you create configurable modules and provides a way to reduce the majority of dynamic module boilerplate.

ConflictException

Defines an HTTP exception for Conflict type errors.

FileTypeValidator

Defines the built-in FileTypeValidator. It validates incoming files by examining their magic numbers using the file-type package, providing more reliable file type validation than just checking the mimetype string.

FileValidator

Interface describing FileValidators, which can be added to a ParseFilePipe

ForbiddenException

Defines an HTTP exception for Forbidden type errors.

GatewayTimeoutException

Defines an HTTP exception for Gateway Timeout type errors.

GoneException

Defines an HTTP exception for Gone type errors.

HttpException

Defines the base Nest HTTP exception, which is handled by the default Exceptions Handler.

HttpVersionNotSupportedException

Defines an HTTP exception for Http Version Not Supported type errors.

ImATeapotException

Defines an HTTP exception for ImATeapotException type errors.

InternalServerErrorException

Defines an HTTP exception for Internal Server Error type errors.

IntrinsicException

Exception that represents an intrinsic error in the application. When thrown, the default exception filter will not log the error message.

MaxFileSizeValidator

Defines the built-in MaxSize File Validator

MethodNotAllowedException

Defines an HTTP exception for Method Not Allowed type errors.

MisdirectedException

Defines an HTTP exception for Misdirected type errors.

NotAcceptableException

Defines an HTTP exception for Not Acceptable type errors.

NotFoundException

Defines an HTTP exception for Not Found type errors.

NotImplementedException

Defines an HTTP exception for Not Implemented type errors.

ParseFilePipeBuilder
PayloadTooLargeException

Defines an HTTP exception for Payload Too Large type errors.

PreconditionFailedException

Defines an HTTP exception for Precondition Failed type errors.

RequestTimeoutException

Defines an HTTP exception for Request Timeout type errors.

ServiceUnavailableException

Defines an HTTP exception for Service Unavailable type errors.

StreamableFile
UnauthorizedException

Defines an HTTP exception for Unauthorized type errors.

UnprocessableEntityException

Defines an HTTP exception for Unprocessable Entity type errors.

UnsupportedMediaTypeException

Defines an HTTP exception for Unsupported Media Type type errors.

Decorators

Bind

Decorator that binds parameter decorators to the method that follows.

Body

Route handler parameter decorator. Extracts the entire body object property, or optionally a named property of the body object, from the req object and populates the decorated parameter with that value. Also applies pipes to the bound body parameter.

Catch

Decorator that marks a class as a Nest exception filter. An exception filter handles exceptions thrown by or not handled by your application code.

Controller

Decorator that marks a class as a Nest controller that can receive inbound requests and produce responses.

Global

Decorator that makes a module global-scoped.

Header

Request method Decorator. Sets a response header.

HostParam

Route handler parameter decorator. Extracts the hosts property from the req object and populates the decorated parameter with the value of params. May also apply pipes to the bound parameter.

HttpCode

Request method Decorator. Defines the HTTP response status code. Overrides default status code for the decorated request method.

Inject

Decorator that marks a constructor parameter as a target for Dependency Injection (DI).

Injectable

Decorator that marks a class as a provider. Providers can be injected into other classes via constructor parameter injection using Nest's built-in Dependency Injection (DI) system.

Module

Decorator that marks a class as a module.

Optional

Parameter decorator for an injected dependency marking the dependency as optional.

Param

Route handler parameter decorator. Extracts the params property from the req object and populates the decorated parameter with the value of params. May also apply pipes to the bound parameter.

Query

Route handler parameter decorator. Extracts the query property from the req object and populates the decorated parameter with the value of query. May also apply pipes to the bound query parameter.

RawBody

Route handler parameter decorator. Extracts the rawBody Buffer property from the req object and populates the decorated parameter with that value. Also applies pipes to the bound rawBody parameter.

Redirect

Redirects request to the specified URL.

Render

Route handler method Decorator. Defines a template to be rendered by the controller.

Sse

Declares this route as a Server-Sent-Events endpoint

UploadedFile

Route handler parameter decorator. Extracts the file object and populates the decorated parameter with the value of file. Used in conjunction with multer middleware for Express-based applications.

UploadedFiles

Route handler parameter decorator. Extracts the files object and populates the decorated parameter with the value of files. Used in conjunction with multer middleware for Express-based applications.

UseGuards

Decorator that binds guards to the scope of the controller or method, depending on its context.

UseInterceptors

Decorator that binds interceptors to the scope of the controller or method, depending on its context.

UsePipes

Decorator that binds pipes to the scope of the controller or method, depending on its context.

Version

Sets the version of the endpoint to the passed version

createParamDecorator

Defines HTTP route param decorator

mixin

Pipes

DefaultValuePipe

Defines the built-in DefaultValue Pipe

ParseArrayPipe

Defines the built-in ParseArray Pipe

ParseBoolPipe

Defines the built-in ParseBool Pipe

ParseEnumPipe

Defines the built-in ParseEnum Pipe

ParseFilePipe

Defines the built-in ParseFile Pipe. This pipe can be used to validate incoming files with @UploadedFile() decorator. You can use either other specific built-in validators or provide one of your own, simply implementing it through FileValidator interface and adding it to ParseFilePipe's constructor.

ParseFloatPipe

Defines the built-in ParseFloat Pipe

ParseIntPipe

Defines the built-in ParseInt Pipe

ParseUUIDPipe

Defines the built-in ParseUUID Pipe

ValidationPipe

Functions

applyDecorators

Function that returns a new decorator that applies all decorators provided by param

filterLogLevels

Structures

ArgumentMetadata

Interface describing a pipe implementation's transform() method metadata argument.

ArgumentsHost

Provides methods for retrieving the arguments being passed to a handler. Allows choosing the appropriate execution context (e.g., Http, RPC, or WebSockets) to retrieve the arguments from.

CallHandler

Interface providing access to the response stream.

CanActivate

Interface defining the canActivate() function that must be implemented by a guard. Return value indicates whether or not the current request is allowed to proceed. Return can be either synchronous (boolean) or asynchronous (Promise or Observable).

ClassProvider

Interface defining a Class type provider.

ClassSerializerContextOptions
ClassSerializerInterceptorOptions
ConfigurableModuleAsyncOptions

Interface that represents the module async options object Factory method name varies depending on the "FactoryClassMethodKey" type argument.

ConfigurableModuleBuilderOptions
ConfigurableModuleHost

Configurable module host. See properties for more details

ConsoleLoggerOptions
ControllerOptions

Interface defining options that can be passed to @Controller() decorator

DynamicModule

Interface defining a Dynamic Module.

ExceptionFilter

Interface describing implementation of an exception filter.

ExecutionContext

Interface describing details about the current request pipeline.

ExistingProvider

Interface defining an Existing (aliased) type provider.

FactoryProvider

Interface defining a Factory type provider.

HttpStatus
INestApplication

Interface defining the core NestApplication object.

INestApplicationContext

Interface defining NestApplicationContext.

INestMicroservice

Interface describing Microservice Context.

IntrospectionResult
LoggerService
MiddlewareConsumer

Interface defining method for applying user defined middleware to routes.

ModuleMetadata

Interface defining the property object that describes the module.

NestApplicationOptions
NestHybridApplicationOptions
NestInterceptor

Interface describing implementation of an interceptor.

NestMiddleware
NestModule
OnApplicationBootstrap

Interface defining method called once the application has fully started and is bootstrapped.

OnApplicationShutdown

Interface defining method to respond to system signals (when application gets shutdown by, e.g., SIGTERM)

OnModuleDestroy

Interface defining method called just before Nest destroys the host module (app.close() method has been evaluated). Use to perform cleanup on resources (e.g., Database connections).

OnModuleInit

Interface defining method called once the host module has been initialized.

ParseArrayOptions
ParseBoolPipeOptions
ParseEnumPipeOptions
ParseFileOptions
ParseFloatPipeOptions
ParseIntPipeOptions
ParseUUIDPipeOptions
PipeTransform

Interface describing implementation of a pipe.

RpcExceptionFilter

Interface describing implementation of an RPC exception filter.

Scope
ScopeOptions
ValidationError

Validation error description.

ValidationPipeOptions
ValueProvider

Interface defining a Value type provider.

VersioningType
WebSocketAdapter
WsExceptionFilter

Interface describing implementation of a Web Sockets exception filter.

WsMessageHandler

Types

All

Route handler (method) Decorator. Routes all HTTP requests to the specified path.

ConfigurableModuleCls

Class that represents a blueprint/prototype for a configurable Nest module. This class provides static methods for constructing dynamic modules. Their names can be controlled through the "MethodKey" type argument.

ConfigurableModuleOptionsFactory

Interface that must be implemented by the module options factory class. Method key varies depending on the "FactoryClassMethodKey" type argument.

Copy

Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.

Delete

Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.

Dependencies

Decorator that sets required dependencies (required with a vanilla JavaScript objects)

Get

Route handler (method) Decorator. Routes HTTP GET requests to the specified path.

Head

Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.

Headers

Route handler parameter decorator. Extracts the headers property from the req object and populates the decorated parameter with the value of headers.

InjectableOptions

Defines the injection scope.

InjectionToken
Ip

Route handler parameter decorator. Extracts the Ip property from the req object and populates the decorated parameter with the value of ip.

Lock

Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.

LogLevel
Mkcol

Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.

Move

Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.

Next

Route handler parameter decorator. Extracts reference to the Next function from the underlying platform and populates the decorated parameter with the value of Next.

OptionalFactoryDependency
Options

Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.

Paramtype
Patch

Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.

Post

Route handler (method) Decorator. Routes HTTP POST requests to the specified path.

Propfind

Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.

Proppatch

Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.

Provider
Put

Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.

RawBodyRequest
Request

Route handler parameter decorator. Extracts the Request object from the underlying platform and populates the decorated parameter with the value of Request.

Response

Route handler parameter decorator. Extracts the Response object from the underlying platform and populates the decorated parameter with the value of Response.

Search

Route handler (method) Decorator. Routes HTTP SEARCH requests to the specified path.

SerializeOptions
Session

Route handler parameter decorator. Extracts the Session object from the underlying platform and populates the decorated parameter with the value of Session.

SetMetadata

Decorator that assigns metadata to the class/function using the specified key.

Unlock

Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.

UseFilters

Decorator that binds exception filters to the scope of the controller or method, depending on its context.

VERSION_NEUTRAL

Indicates that this will work for any version passed in the request, or no version.

VersioningOptions
forwardRef