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
Copy file name to clipboardexpand all lines: docs/docs/06_plugins/index.md
+16-2
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Plugins can hook into the lifecycle of the `ClsModule` and the CLS context setup
8
8
9
9
## Usage
10
10
11
-
To use a plugin, pass it to the `forRoot` method of the `ClsModule`:
11
+
To use a plugin, pass it to the `forRoot`or `forRootAsync`method of the `ClsModule`:
12
12
13
13
```ts
14
14
ClsModule.forRoot({
@@ -18,12 +18,26 @@ ClsModule.forRoot({
18
18
});
19
19
```
20
20
21
-
If you need to inject Plugins from an external module, use the `ClsModule.registerPlugins()` registration to import the containing module.
21
+
```ts
22
+
ClsModule.forRootAsync({
23
+
// highlight-start
24
+
plugins: [newMyPlugin()],
25
+
// highlight-end
26
+
});
27
+
```
28
+
29
+
~~If you need to inject Plugins from an external module, use the `ClsModule.registerPlugins()` registration to import the containing module.~~
22
30
23
31
```ts
24
32
ClsModule.registerPlugins([newMyPlugin()]);
25
33
```
26
34
35
+
:::warning
36
+
37
+
The `ClsModule.registerPlugins` method is deprecated and will be removed in a future release due to a major refactor of the plugin architecture. All plugins must be registered via the root method.
38
+
39
+
:::
40
+
27
41
## Available plugins
28
42
29
43
For a list of plugins managed by the author of `nestjs-cls`, see the [Available Plugins](./01_available-plugins/index.md) page.
0 commit comments