Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
nestjs-cqrs-extra
Advanced tools
Library that provides additional features for the NestJS CQRS module.
A module for that provides additional features for the NestJS CQRS module.
Nest CQRS Extra is a module that provides additional features for the NestJS CQRS module. It provides a way to send commands and queries through a message broker (e.g. NATS, Redis, MQTT) to the appropriate handlers in microservices. It also provides a way to create sagas that can be used to handle events.
Features
$ npm install nestjs-cqrs-extra @nestjs/microservices nats
import { Module } from '@nestjs/common';
import { CqrsModule } from 'nestjs-cqrs-extra';
@Module({
imports: [
CqrsModule.forRoot({
options: { servers: ['nats://localhost:4222'] }
})
]
})
export class AppModule {
}
You can change adapter to redis
or mqtt
by changing the adapter
option.
import { BaseCommand } from 'nestjs-cqrs-extra';
export class CreateUserCommand extends BaseCommand<string> {
constructor(public readonly name: string) {
super();
}
}
import { CommandHandler } from 'nestjs-cqrs-extra';
import { CreateUserCommand } from './create-user.command';
import { Controller } from '@nestjs/common';
@Controller()
export class UserCommandsController {
@CommandHandler(CreateUserCommand)
public createUser(command: CreateUserCommand): string {
return `User ${command.name} created`;
}
}
Also you can use @QueryHandler
and @EventHandler
decorators to handle queries and events.
import { CommandBus } from 'nestjs-cqrs-extra';
import { Injectable } from '@nestjs/common';
@Injectable()
export class UserService {
constructor(private readonly commandBus: CommandBus) {
}
async createUser(name: string): Promise<string> {
return this.commandBus.execute(new CreateUserCommand(name));
}
}
FAQs
Library that provides additional features for the NestJS CQRS module.
The npm package nestjs-cqrs-extra receives a total of 59 weekly downloads. As such, nestjs-cqrs-extra popularity was classified as not popular.
We found that nestjs-cqrs-extra demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.