Skip to content

Commit 6e33498

Browse files
committed
remove duplicate includes
1 parent 59e2357 commit 6e33498

File tree

1 file changed

+36
-1
lines changed
  • docs/platforms/javascript/guides/nestjs

1 file changed

+36
-1
lines changed

docs/platforms/javascript/guides/nestjs/index.mdx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,42 @@ To import and initialize Sentry, create a file named `instrument.ts` in the root
3737

3838
### Apply Instrumentation to Your App
3939

40-
<PlatformContent includePath="getting-started-use" />
40+
Make sure to import the `instrument.ts` file before any other modules:
41+
42+
```typescript {filename: main.ts} {1-2}
43+
// Import this first!
44+
import "./instrument";
45+
46+
// Now import other modules
47+
import { NestFactory } from "@nestjs/core";
48+
import { AppModule } from "./app.module";
49+
50+
async function bootstrap() {
51+
const app = await NestFactory.create(AppModule);
52+
await app.listen(3000);
53+
}
54+
55+
bootstrap();
56+
```
57+
58+
Afterward, add the `SentryModule` as a root module to your main module:
59+
60+
```typescript {filename: app.module.ts} {2, 8}
61+
import { Module } from "@nestjs/common";
62+
import { SentryModule } from "@sentry/nestjs/setup";
63+
import { AppController } from "./app.controller";
64+
import { AppService } from "./app.service";
65+
66+
@Module({
67+
imports: [
68+
SentryModule.forRoot(),
69+
// ...other modules
70+
],
71+
controllers: [AppController],
72+
providers: [AppService],
73+
})
74+
export class AppModule {}
75+
```
4176

4277
## Step 3: Capture Nest.js Errors
4378

0 commit comments

Comments
 (0)