Skip to content

Commit 4bdbb0e

Browse files
chore: improve wording
1 parent a82890e commit 4bdbb0e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

content/microservices/basics.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,19 @@ One technique is to import the `ClientsModule`, which exposes the static `regist
235235

236236
The `name` property serves as an **injection token** that can be used to inject an instance of a `ClientProxy` where needed. The value of the `name` property, as an injection token, can be an arbitrary string or JavaScript symbol, as described [here](https://docs.nestjs.com/fundamentals/custom-providers#non-class-based-provider-tokens).
237237

238-
The `options` property is an object with the same properties we saw in the `createMicroservice()` method earlier.
238+
The `options` property is an object that contains the same properties we saw in the `createMicroservice()` method earlier.
239239

240240
```typescript
241241
@Module({
242242
imports: [
243243
ClientsModule.register([
244244
{ name: 'MATH_SERVICE', transport: Transport.TCP },
245245
]),
246-
]
247-
...
246+
],
248247
})
249248
```
250249

251-
Or alternatively use the `registerAsync()` method in case you want to pass configuration or do any other async progress.
250+
Alternatively, you can use the `registerAsync()` method if you need to pass in configuration or perform any other asynchronous processes.
252251

253252
```typescript
254253
@Module({
@@ -258,21 +257,19 @@ Or alternatively use the `registerAsync()` method in case you want to pass confi
258257
imports: [ConfigModule],
259258
name: 'MATH_SERVICE',
260259
useFactory: async (configService: ConfigService) => ({
260+
transport: Transport.TCP,
261261
options: {
262-
url: configService.get<string>('URL'),
262+
url: configService.get('URL'),
263263
},
264-
transport: Transport.TCP,
265264
}),
266265
inject: [ConfigService],
267266
},
268267
]),
269-
]
270-
...
268+
],
271269
})
272270
```
273271

274-
275-
Once the module has been imported, we can inject an instance of the `ClientProxy` configured as specified via the `'MATH_SERVICE'` transporter options shown above, using the `@Inject()` decorator.
272+
Once the module has been imported, you can inject an instance of the `ClientProxy` configured with the specified options for the `'MATH_SERVICE'` transporter using the `@Inject()` decorator.
276273

277274
```typescript
278275
constructor(

0 commit comments

Comments
 (0)