Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bamada/nestjs-unleash-sdk

Nestjs unleash module using unleash-sdk
https://github.com/bamada/nestjs-unleash-sdk

nestjs typescript unleash

Last synced: 19 days ago
JSON representation

Nestjs unleash module using unleash-sdk

Awesome Lists containing this project

README

        


NestJS-Unleash-SDK



A NestJS module that uses Unleash SDK to manage feature flags.


[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

---

## 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

```bash
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

```bash
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