-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathapp.controller.ts
More file actions
105 lines (86 loc) · 2.78 KB
/
app.controller.ts
File metadata and controls
105 lines (86 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { Controller, Get, Param, ParseIntPipe, UseGuards, UseInterceptors } from '@nestjs/common';
import { flush } from '@sentry/nestjs';
import { AppService } from './app.service';
import { AsyncInterceptor } from './async-example.interceptor';
import { ExampleInterceptor1 } from './example-1.interceptor';
import { ExampleInterceptor2 } from './example-2.interceptor';
import { ExampleGuard } from './example.guard';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get('test-transaction')
testTransaction() {
return this.appService.testTransaction();
}
@Get('test-middleware-instrumentation')
testMiddlewareInstrumentation() {
return this.appService.testSpan();
}
@Get('test-guard-instrumentation')
@UseGuards(ExampleGuard)
testGuardInstrumentation() {
return {};
}
@Get('test-interceptor-instrumentation')
@UseInterceptors(ExampleInterceptor1, ExampleInterceptor2)
testInterceptorInstrumentation() {
return this.appService.testSpan();
}
@Get('test-async-interceptor-instrumentation')
@UseInterceptors(AsyncInterceptor)
testAsyncInterceptorInstrumentation() {
return this.appService.testSpan();
}
@Get('test-pipe-instrumentation/:id')
testPipeInstrumentation(@Param('id', ParseIntPipe) id: number) {
return { value: id };
}
@Get('test-exception/:id')
async testException(@Param('id') id: string) {
return this.appService.testException(id);
}
@Get('test-expected-400-exception/:id')
async testExpected400Exception(@Param('id') id: string) {
return this.appService.testExpected400Exception(id);
}
@Get('test-expected-500-exception/:id')
async testExpected500Exception(@Param('id') id: string) {
return this.appService.testExpected500Exception(id);
}
@Get('test-expected-rpc-exception/:id')
async testExpectedRpcException(@Param('id') id: string) {
return this.appService.testExpectedRpcException(id);
}
@Get('test-span-decorator-async')
async testSpanDecoratorAsync() {
return { result: await this.appService.testSpanDecoratorAsync() };
}
@Get('test-span-decorator-sync')
async testSpanDecoratorSync() {
return { result: await this.appService.testSpanDecoratorSync() };
}
@Get('kill-test-cron')
async killTestCron() {
this.appService.killTestCron();
}
@Get('flush')
async flush() {
await flush();
}
@Get('test-service-use')
testServiceWithUseMethod() {
return this.appService.use();
}
@Get('test-service-transform')
testServiceWithTransform() {
return this.appService.transform();
}
@Get('test-service-intercept')
testServiceWithIntercept() {
return this.appService.intercept();
}
@Get('test-service-canActivate')
testServiceWithCanActivate() {
return this.appService.canActivate();
}
}