- core: [bugfix] dynamic modules
exports
- core: [bugfix] add missing
app.engine()
wrapper
- core: [bugfix] dynamic modules recurrent imports fix
- testing: [bugfix] issue #326
- common: [feature] rename
modules
toimports
(@Module()
decorator) - core: [feature] exception filters with empty
@Catch()
metadata handle each occurred exception - core: [improvement] increase performance
- common: [feature]
INestAplication
provides agetHttpServer()
method now - websockets: [bugfix]
IoAdapter
bugfix
- common: bugfix #286
- core: dynamic modules feature
- core: global scope feature
- core:
ExternalContextCreator
&ModulesContainer
- core: merge
NestApplicationContext
withNestApplication
- core:
NotFoundException
is thrown when route is not available #298 - core: add
set()
wrapper around native express methods - core: bugfix #281
- websockets: bugfix #271
- microservices: log RPC exceptions #303
- microservices: merge
NestApplicationContext
withNestMicroservice
- microservices: handle ECONNREFUSED #288
- common:
ValidationPipe
improvement - common: custom route params decorators accepts pipes now
- core: bugfix #268
- core: possibility to create the
NestApplicationContext
usingNestFactory.createApplicationContext()
(Nest application without HTTP server / microservice in the background) - core: create custom params decorators feature (
createRouteParamDecorator()
)
- common:
ParseIntPipe
is now available out-of-the-box (@nestjs/common
) - common: package contains a set of useful HTTP exceptions now, such as
ForbiddenException
,UnauthorizedException
,BadRequestException
etc - core:
HttpException
was moved to@nestjs/common
. This one fromcore
packages is now DEPRECATED and will be removed in the next MAJOR release
- common:
ValidationPipe
is now available out-of-the-box (@nestjs/common
) - core:
json
andurlencoded
(body-parser
) middlewares are applied by default now, bugfix #252 - core more informative error message (injector) #223
example:
[ExceptionHandler] Nest can't resolve dependencies of the UsersService (+, +, ?, +, +, +). Please verify whether [2] argument is available in the current context.
- core: bugfix #240 - middlewares container state
- core: bugifx #257 -
@Next()
issue - testing: testing module is now independent from
@nestjs/microservices
- websockets: bugfix #242
- core: IoAdapter bugfix
- core: log controller prefix #153
- websockets: gateway listen the same port as the app #126
- common: remove deprecated
@ExceptionFilters()
decorator - core: update to latest *express version (4.16.2)
- core: bugfix #187
- core: bugfix #185
- all: packages codependency refactor
- all: add lerna package
- core: forward reference bugfixes & security updates
- common: add
forwardRef()
util - core: improve injector & dependencies scanner
- common: add
@Bind()
and@Dependencies()
decorators to fix route parameters decorators (pure JavaScript compatibility issue) - core: improve performance
- core: add possibility to setup global guards and global interceptors
- common:
INestApplication
hasuseGlobalInterceptors()
anduseGlobalGuards()
now - microservices: add possibility to setup global guards, interceptors, filters and pipes
- core: add timestamp to log output
- core: improve pipes performance
- core: add ability to omit param name when passing param-scoped pipe/s
- websockets: fix disconnect event issue (pass client instead of socket.io instance)
@nestjs/core
- Asynchronous
NestFactory
read more - New response handling approach read more
- Interceptors feature read more
@Shared()
deprecated (modules are singletons by default) read more@SingleScope()
decorator read more- Modules re-exporting read more
- Deffered & functional middlewares read more
- Guards feature read more
- Async components read more
- Hierarchical injector improvements read more
- Mixin classes read more
- New
INestApplication
API
@nestjs/microservices
- Possibility to return Promise / Observable / plain value read more
- Guards & Interceptors & Pipes & Exception Filters integration
@nestjs/websockets
- Possibility to return Promise / Observable / plain value read more
- Guards & Interceptors & Pipes & Exception Filters integration
- New
WebSocketAdapter
API
@nestjs/testing
- Completely rewritten testing package
@nestjs/core
- Hierarchical injector bugfix,
- Middlewares
@UseFilters()
bugfix (#95).
@nestjs/microservices
- TCP server / client bugfix (#91)
@nestjs/common - BREAKING CHANGE
- You should now pass objects into
@UseFilters()
decorator instead of metatypes, - Exception Filters can't inject dependencies (they're not coupled with modules),
@ExceptionFilters()
is deprecated, use@UseFilters()
instead.INestApplication
has new methods -useGlobalFilters()
anduseGlobalPipes()
,- New lifecycle hook -
OnModuleDestroy
interface.
@nestjs/core
@Pipe()
feature (async & sync),- Exception Filters can have global, controller and method scope.
@nestjs/websockets - BREAKING CHANGE
- Use
useWebSocketAdapter()
instead ofsetIoAdapter()
, - You can port any WS library - just implement
WebSocketAdapter
(@nestjs/common).
@nestjs/microservices - BREAKING CHANGE
- Now methods have to return
Observable
, and they receive only one argumentdata
, - Microservices can return multiple values, but after emitting
Observable
has to be COMPLETED! - You can port any transport strategy instead of built-in Redis/TCP, just implement
CustomTransportStrategy
.
@nestjs/common, @nestjs/websockets
INestApplication
andINestMicroservice
has new method now -setIoAdapter()
,- Ability to use custom
IoAdapter
@nestjs/common, @nestjs/websockets, @nestjs/microservices
INestApplication
andINestMicroservice
has new method now -setIoAdapter()
,- Ability to use custom
IoAdapter
@nestjs/common, @nestjs/core
INestApplication
has new methods now -init()
,setGlobalPrefix()
,connectMicroservice()
,close()
,startAllMicroservices()
,INestMicroservice
has new method -close()
@nestjs/common
Req()
(Request()
) andRes()
(Response()
) aliases to avoid conflicts with express typings
- Hierarchical injector improvements
@Shared(token?: string)
decorator for scoped, shared Modules- Modules are not singletons anymore
- Added
iterare
library for applying multiple transformations to a collection Logger
service is public,- Nest is now splitted into feature packages:
@nestjs/core
@nestjs/common
@nestjs/microservices
@nestjs/testing
@nestjs/websockets
rxjs
,redis
andreflect-metadata
moved intopeerDependencies
@Patch()
support
- Added Gateway Middlewares support:
@WebSocketGateway({
port: 2000,
middlewares: [ChatMiddleware],
})
Gateway Middleware example:
@Middleware()
export class ChatMiddleware implements GatewayMiddleware {
public resolve(): (socket, next) => void {
return (socket, next) => {
console.log('Authorization...');
next();
};
}
}
- New Gateway lifecycle interfaces
OnGatewayInit
,OnGatewayConnection
,OnGatewayDisconnect
@SubscribeMessage()
now accepts also plain strings:
@SubscribeMessage('event')
@Controller()
now accepts also plain strings:
@Controller('users')
HttpStatus
(HttpStatus.OK
etc.) enumerator- Route params decorators support
Request: () => ParameterDecorator
Response: () => ParameterDecorator
Next: () => ParameterDecorator
Query: (property?: string) => ParameterDecorator
Body: (property?: string) => ParameterDecorator
Param: (property?: string) => ParameterDecorator
Session: () => ParameterDecorator
Headers: (property?: string) => ParameterDecorator
MiddlewaresBuilder
->MiddlewaresConsumer
- Exception Filters support
@ExceptionFilters(CustomExceptionFilter, NextExceptionFilter)
export class UsersController {}
Exception filter example:
export class CustomException {}
@Catch(CustomException)
export class CustomExceptionFilter implements ExceptionFilter {
public catch(exception, response) {
response.status(500).json({
message: 'Custom exception message.',
});
}
}
- Module injection support:
export class UsersController {
constructor(private module: UsersModule) {}
}
ModuleRef
support
- MiddlewareBuilder:
use()
deprecated, useapply()
instead - MiddlewareBuilder: new
apply()
method
- Support for
@Post
,@Get
,@Delete
,@Put
,@All
decorators - Added ability to pass data to middleware metatypes
@Inject
->@Dependencies
@Inject
decorator for custom constructor parameters- Custom providers support (useClass, useValue, useFactory)
- Microservices support (TCP & Redis transports)
- NestRunner -> NestFactory
- Simplify application initialization & configuration
- Added abillity to pass custom express instance
@Inject
decorator for ES6+- SocketGateway -> WebSocketGateway
- GatewayServer -> WebSocketServer