Skip to content

Commit 4a165ed

Browse files
committed
docs(recipes): Hint more uses of NestJS CLS
1 parent 3e1553b commit 4a165ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/recipes/async-local-storage.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function bootstrap() {
5858
userId: req.headers['x-user-id'],
5959
};
6060
// and and pass the "next" function as callback
61-
// to the "als.run" method with together the store.
61+
// to the "als.run" method together with the store.
6262
als.run(store, () => next());
6363
});
6464
}
@@ -101,7 +101,7 @@ The store can then be accessed with an injectable `ClsService`, or entirely abst
101101
102102
#### Installation
103103

104-
Apart from a peer dependency on the `@nestjs` libs, it only depends on the built-in Node.js API. Install it as any other package.
104+
Apart from a peer dependency on the `@nestjs` libs, it only uses the built-in Node.js API. Install it as any other package.
105105

106106
```bash
107107
npm i nestjs-cls
@@ -165,6 +165,8 @@ export interface MyClsStore extends ClsStore {
165165
userId: number
166166
}
167167
```
168+
169+
> info **hint** It it also possible to let the package automatically generate a Request ID and access it later with `cls.getId()`, or to get the whole Request object using `cls.get(CLS_REQ)`.
168170
#### Testing
169171

170172
Since the `ClsService` is just another injectable provider, it can be entirely mocked out in unit tests.

0 commit comments

Comments
 (0)