ps2census-nestjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

PS2Census NestJS

CI npm version David DM Badge

About

Easy integration of the PS2 Census library for NestJS.

Installation

npm install ps2census ps2census-nestjs

Getting started

import {CensusModule} from 'ps2census-nestjs';

@Module({
  imports:[
    CensusModule.forRoot({
      serviceID: 'your DBG service id',
      // Any other Client options from ps2census
    }),
    // or
    CensusModule.forRootAsync({
      useFactory: () => ({
        serviceID: 'your DBG service id',
        // Any other Client options from ps2census
      }),
    }),
  ],
  providers: [CensusGateway],
})
import { Injectable } from '@nestjs/common';
import {Death} from 'ps2census';
import {CensusClient} from 'ps2census-nestjs';

@Injectable() // Controller decorator can also be used
export class CensusGateway {
  constructor(
    client: CensusClient,
  ) {}

  @On({event: 'death'})
  deathHandler(death: Death): void {
    // Do something
  }
}

Dependencies (0)

    Dev Dependencies (13)

    Package Sidebar

    Install

    npm i ps2census-nestjs

    Weekly Downloads

    5

    Version

    1.0.0

    License

    Apache-2.0

    Unpacked Size

    121 kB

    Total Files

    46

    Last publish

    Collaborators

    • microwavekonijn