Getting Started
To start using this module, you can follow these steps:
- Install the package by running npm install nestjs-unleash-sdk
- Import the module into your NestJS application using the following code:
Setup the module
import { Module } from '@nestjs/common';
import { UnleashModule } from 'nestjs-unleash-sdk';
@Module({
imports: [
UnleashModule.forRoot({
url: 'https://unleash.herokuapp.com/api',
appName: 'nestjs-app',
instanceId: 'to-define',
}),
],
})
export class AppModule {}
Check a feature flag
import { Controller, Get, Query } from '@nestjs/common';
import { UnleashService } from 'nestjs-unleash-sdk';
@Controller()
export class AppController {
constructor(private readonly unleashService: UnleashService) { }
@Get()
getHello(@Query('email') email: string): any {
const options = { userId: email };
const isEnabled = this.unleashService.client.isEnabled('feat', options);
return isEnabled;
}
}
TODO
- Add feature flag decorators