nest-shrimpy
v1.0.1
Published
Shrimpy wrapper for NestJS
Downloads
16
Readme
This dynamic module was generated with Nest Dynamic Package Generator Schematics. You can read more about using the generator here.
Installation
To install this generated project:
npm install nest-shrimpy --save
(or yarn equivalent)
Test
You can test this module against your Shrimpy keys (set in the .env file)
cd ./node_modules/nest-vault
npm run start:dev
Then connect to http://localhost:3000 and you should see the status of your Shrimpy client.
Usage
@Module({
imports: [
ConfigModule.forRoot(),
NestShrimpyModule.registerAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => {
return {
privateKey: configService.get('SHRIMPY_PRIVATE_KEY'),
publicKey: configService.get('SHRIMPY_PUBLIC_KEY'),
token: configService.get('SHRIMPY_TOKEN'),
};
},
inject: [ConfigService],
}),
],
})
Look at src/nest-shrimpy-client
for more details.
This wrapper is using shrimpy-node module, so take a look how to use it.
@Controller()
export class NestShrimpyClientController {
constructor(private readonly nestShrimpyService: NestShrimpyService) {}
@Get()
async index() {
const client: ShrimpyApiClient =
this.nestShrimpyService.getShrimpyApiClient();
return client.getStatus();
}
}
Good luck!