You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Usage in controllers or providers](#usage-in-controllers-or-providers)
22
+
-[Usage in controllers or providers](#usage-in-controllers-or-providers)
23
+
-[Custom context](#custom-context)
23
24
-[Configuration](#configuration)
24
25
-[Default strategies](#default-strategies)
25
26
-[Custom strategies](#custom-strategies)
26
27
-[License](#license)
27
28
28
-
# Usage
29
+
# Setup
29
30
30
31
```sh
31
32
$ npm install --save nestjs-unleash
@@ -35,7 +36,7 @@ Import the module with `UnleashModule.forRoot(...)` or `UnleashModule.forRootAsy
35
36
36
37
## Synchronous configuration
37
38
38
-
Use `UnleashModule.forRoot()`. Available ptions are described in the [UnleashModuleOptions interface](#configuration).
39
+
Use `UnleashModule.forRoot()`. Available options are described in the [UnleashModuleOptions interface](#configuration).
39
40
40
41
```ts
41
42
@Module({
@@ -52,7 +53,7 @@ export class MyModule {}
52
53
53
54
## Asynchronous configuration
54
55
55
-
If you want to use retrieve you[Unleash options](#configuration) dynamically, use `UnleashModule.forRootAsync()`. Use `useFactory` and `inject` to import your dependencies. Example using the `ConfigService`:
56
+
If you want to use your[Unleash options](#configuration) dynamically, use `UnleashModule.forRootAsync()`. Use `useFactory` and `inject` to import your dependencies. Example using the `ConfigService`:
56
57
57
58
```ts
58
59
@Module({
@@ -72,7 +73,7 @@ If you want to use retrieve you [Unleash options](#configuration) dynamically, u
72
73
exportclassMyModule {}
73
74
```
74
75
75
-
##Usage in controllers or providers
76
+
# Usage in controllers or providers
76
77
77
78
In your controller use the `UnleashService` or the `@IfEnabled(...)` route decorator:
78
79
@@ -101,6 +102,46 @@ export class AppController {
101
102
}
102
103
```
103
104
105
+
## Custom context
106
+
107
+
The `UnleashContext` grants access to request related information like user ID or IP address.
108
+
109
+
In addition, the context can be dynamically enriched with further information and subsequently used in a separate strategy:
0 commit comments