1. Install the SDK
npm i tggl-client
2. Create the client
import { TgglClient } from 'tggl-client'
const client = new TgglClient('YOUR_API_KEY')
3. Start using feature flags
import { Injectable, NestMiddleware } from '@nestjs/common'
import { Request, Response, NextFunction } from 'express'
@Injectable()
export class FlagsMiddleware implements NestMiddleware {
async use(req: Request, res: Response, next: NextFunction) {
const flags = await client.evalContext({
userId: 'foo',
email: 'foo@gmail.com',
})
req['flags'] = flags
next()
}
}
You can work with the API or choose to do local flag evaluation to evaluate millions of flags per second. The SDK also supports live configuration updates.
Written in Typescript
Types are automatically pulled from the API and are available in your IDE. Nor more guessing what the return type of a flag is, all typos are picked-up by your IDE and CI build process.
