@chimeraprime/fpl-nest-wrapper
v0.0.5
Published
`$ npm install --save @chimeraprime/fpl-nest-wrapper class-transformer axios-cache-adapter`
Downloads
12
Keywords
Readme
$ npm install --save @chimeraprime/fpl-nest-wrapper class-transformer axios-cache-adapter
Usage
import { FplWrapperModule } from '@chimeraprime/fpl-nest-wrapper';
@Module({
imports: [
FplWrapperModule.forRoot()
],
controllers: [YourController],
})
export class AppModule {}
import {
Controller, Get, UseInterceptors, ClassSerializerInterceptor,
} from '@nestjs/common';
import { PlayerEntity, TeamEntity, FplWrapperService } from '@chimeraprime/fpl-nest-wrapper';
@UseInterceptors(ClassSerializerInterceptor)
export class YourController {
constructor(
private readonly fplWrapperService: FplWrapperService,
) { }
@Get('/players')
async getPlayers(): Promise<PlayerEntity[]> {
return this.fplWrapperService.getPlayers();
}
@Get('/teams')
async getTeams(): Promise<TeamEntity[]> {
return this.fplWrapperService.getTeams();
}
}