1.0.1 • Published 3 years ago

nest-shrimpy v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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!