1.0.0 • Published 10 months ago

@nest-hero/dapr v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Dapr Module for NestJS

Dapr module for NestJS, fully compatible with any Dapr and NestJS version.

Supported Dapr features:

  • Pubsub API
    • Single Pubsub connection
    • Multiple Pubsub connection
  • Invocation API
  • Binding API
  • Configuration API
  • Secret API

Installation

npm install nestjs-dapr
yarn add nestjs-dapr
pnpm add nestjs-dapr

Usage

Pubsub

export class AppController {
  @Subscribe('topic')
  handler(data: YourDefinedTopicData, fullPayload: DaprPubSubPayload) {
    console.log(data)
  } 
}
export type DaprPubSubPayload = {
  data: unknow // data that you publish to dapr
  datacontenttype: string // default 'application/json'
  id: string
  pubsubname: string
  source: string // app-id
  specversion: string 
  time: string
  topic: string
  traceid: string
  traceparent: string
  tracestate: string
  type: string
}
1.0.0

10 months ago