forked from lukeautry/tsoa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubresourceController.ts
27 lines (23 loc) · 981 Bytes
/
subresourceController.ts
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
import { Get, Path, Route } from '@tsoa/runtime';
@Route('SubResourceTest/{mainResourceId}/SubResource')
export class SubResourceTestController {
@Get()
public async getSubResource(@Path('mainResourceId') mainResourceId: string): Promise<string> {
return mainResourceId;
}
@Get('{subResourceId}')
public async getWithParameter(@Path('mainResourceId') mainResourceId: string, @Path('subResourceId') subResourceId: string): Promise<string> {
return `${mainResourceId}:${subResourceId}`;
}
}
@Route('SubResourceColonTest/:mainResourceId/SubResource')
export class SubResourceColonTestController {
@Get()
public async getSubResource(@Path('mainResourceId') mainResourceId: string): Promise<string> {
return mainResourceId;
}
@Get('{subResourceId}')
public async getWithParameter(@Path('mainResourceId') mainResourceId: string, @Path('subResourceId') subResourceId: string): Promise<string> {
return `${mainResourceId}:${subResourceId}`;
}
}