Skip to content

Commit 9c24d50

Browse files
Update migration.md
1 parent 4f1724e commit 9c24d50

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

content/migration.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,27 @@ With Nest v8, you should use the `@grpc/grpc-js` library instead.
1616
#### NATS strategy
1717

1818
NATS has released a new major version (2.0) which has many changes and it is not API compatible with `[email protected]`.
19-
If you interact with a Nest microservice (that uses NATS as a transfer layer), from a service written in a different framework, please, see their [migration document](https://github.com/nats-io/nats.js/blob/master/migration.md) to learn what's changed in v2.
20-
Otherwise, you should not see any specific differences when communicating from one Nest microservice and another (although we use v2 now, there are no API differences - just make sure to upgrade the `nats` package: `npm i nats@latest`).
19+
If you interact with a Nest microservice (that uses NATS as a transfer layer), from a service written in a different framework, please, see their [migration document](https://github.com/nats-io/nats.js/blob/master/migration.md) to learn what's changed in v2. Otherwise, you should not see any major differences when communicating between Nest microservices.
20+
21+
To upgrade, make sure to install the latest version of the `nats` package (`npm i nats@latest`). Also, update your [NATS configuration](https://github.com/nats-io/nats.js/blob/master/migration.md#changed-configuration-properties). Example:
22+
23+
```typescript
24+
// Before
25+
const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, {
26+
transport: Transport.NATS,
27+
options: {
28+
url: 'nats://localhost:4222',
29+
},
30+
});
31+
32+
// Now
33+
const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, {
34+
transport: Transport.NATS,
35+
options: {
36+
servers: ['nats://localhost:4222'],
37+
},
38+
});
39+
```
2140

2241
#### `@All()` decorator
2342

0 commit comments

Comments
 (0)