node-decorators

node-decorators

MIT License

Downloads
14.1K
Stars
380
Committers
17

Bot releases are visible (Hide)

node-decorators - Server-1.0.0-beta.18 Latest Release

Published by serhiisol about 1 year ago

Core

  • Fixed Decorate replacing class parameter

Http

  • Added getAdapter to HttpModule

Sockets

  • Removed @Disconnecting event
  • Added getAdapter to SocketsModule
  • Added adapter.disconnect if error occurs on connection
node-decorators - Server-1.0.0-beta.17

Published by serhiisol about 1 year ago

  • Sockets swagger support
  • Fixed ApiOperation usage
node-decorators - Server-1.0.0-beta.16

Published by serhiisol about 1 year ago

Core

  • Changed param metadata source - changed it to method
  • paramDecoratorFactory adds callIndex to the param, in case if few decorators are used for the same method
  • Added base HandlerCreator abstract class
  • MetadataScanner moved to the core

Http

  • Reused HandlerCreator class for handlers
  • Fixed applying all the namespace urls to the routes
  • adapter.close method updated for all the adapters

Sockets

  • Reused HandlerCreator class for handlers
node-decorators - Server-1.0.0-beta.15

Published by serhiisol about 1 year ago

  • Added web sockets module
  • Socket.io adapter
node-decorators - Server-1.0.0-beta.14

Published by serhiisol about 1 year ago

  • Existing server instance can be now provided to the application:
const app = await Application.create(AppModule, server);
  • Adds ability to instantiate an adapter with custom application (express, fastify or koa):
HttpModule.create(new ExpressAdapter(app));
  • adapter.listen no longer receives port:number param, port will be forwarded to the server.listen instance.
node-decorators - Server-1.0.0-beta.13

Published by serhiisol about 1 year ago

  • updated handling of missing views in koa and fastify adapters
node-decorators - Server-1.0.0-beta.12

Published by serhiisol about 1 year ago

  • Koa adapter was added
  • Adjustments to support koa
  • adapter.route was removed in favor of adapter.routes, adapters can now register all routes at once (for example using routers) instead of one at a time.
node-decorators - Server-1.0.0-beta.11

Published by serhiisol about 1 year ago

  • Fastify adapter was added
  • Adjustments to support fastify
  • createParamDecorator and adapter.getParam factory will return function instead, promise-like params are causing delays in execution while awaiting for them in the handler.
node-decorators - Server-1.0.0-beta.10

Published by serhiisol about 1 year ago

  • Added missing imports in swagger
node-decorators - Server-1.0.0-beta.9

Published by serhiisol about 1 year ago

  • Initial release of Swagger Platform
node-decorators - Server-1.0.0-beta.8

Published by serhiisol about 1 year ago

  • Removes standard type validation
  • Adds custom param validators:
post(@Params('id', (id) => !IsNaN(Number(id))) id: number) {}

Resolves #183

node-decorators - Server-1.0.0-beta.7

Published by serhiisol about 1 year ago

  • Updated @decorators/di to 3.1.0 with support of root container
  • Added root container as parent to application container
node-decorators - [email protected]

Published by serhiisol about 1 year ago

  • Introduces Injectable options with providedIn='root' option in it to register root provider.
  • RootContainer is exported out of di package.
node-decorators - Server-1.0.0-beta.6

Published by serhiisol about 1 year ago

  • updated validation for simple types
  • adapter.IsHeadersSent - returns now boolean
node-decorators - Server-1.0.0-beta.5

Published by serhiisol about 1 year ago

  • Added ability to ignore global version to generate url (useful for example for wildcard routes *)
  • Updated param validation
  • Param extraction returns promise
node-decorators - Server-1.0.0-beta.4

Published by serhiisol about 1 year ago

1.0.0-beta.4 release:

  • Adds custom parameter decorator error handling - pipes will receive error for handling (#174)
  • Adds error handling for render process (#173, #175)
node-decorators - [email protected]

Published by serhiisol about 1 year ago

  • Adds ability to mark property as nullable (resolves #179)
node-decorators - [email protected]

Published by serhiisol about 1 year ago

  • Optional dips will return undefined instead of null so default values can be used
node-decorators - [email protected]

Published by serhiisol about 1 year ago

Fixed missing typeVersions and exports in package.json

node-decorators - [email protected]

Published by serhiisol about 1 year ago

Features:

  • Adapters
  • Pipes
  • Payload Validation
  • Modules
  • Simplification
  • Custom Decorators

Adapters

Package is router library agnostic so it's possible to use express, fastify or koa.
In this release only ExpressAdapter is included, more to come.

Pipes

Reimagined middleware. Supports both running code before and after main handler.
There are three types of pipes: global, controller and method at the moment.

Order of Execution:

Global => Controller => Method => Route Handler => Method => Controller => Global

Payload Validation

Based on class-validator and class-transformer system supports payload validation. Standard type validation (i.e. string, object, boolean etc.) is also supported.

@Post('', 200)
create(@Body() post: PostType) {
  return post;
}

@Get(':id', 200)
post(@Params('id') id: string) {
  return { id, name: 'hello world' };
}

Modules

Modules keep providers scoped. Resolved via update of @decorators/[email protected] version that supports nesting of containers. With 3.0.0 update is also possible to use multi providers (available through the same injection token).