Skip to content

Commit 1e919f0

Browse files
authored
Improper example codes.
Since the doc is about *Standalone applications*, it's more accurate to use `createApplicationContext()` method.
1 parent 843e410 commit 1e919f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/application-context.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ The standalone application object allows you to obtain a reference to any instan
1919

2020
```typescript
2121
@@filename()
22-
const app = await NestFactory.create(AppModule);
22+
const app = await NestFactory.createApplicationContext(AppModule);
2323
const tasksService = app.get(TasksService);
2424
```
2525

2626
To access the `TasksService` instance we use the `get()` method. The `get()` method acts like a **query** that searches for an instance in each registered module. Alternatively, for strict context checking, pass an options object with the `strict: true` property. With this option in effect, you have to navigate through specific modules to obtain a particular instance from the selected context.
2727

2828
```typescript
2929
@@filename()
30-
const app = await NestFactory.create(AppModule);
30+
const app = await NestFactory.createApplicationContext(AppModule);
3131
const tasksService = app.select(TasksModule).get(TasksService, { strict: true });
3232
```
3333

0 commit comments

Comments
 (0)