ps2census-nestjs
v1.0.0
Published
PS2Census integration for NestJS
Downloads
94
Maintainers
Readme
PS2Census NestJS
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
}
}