I have this controller method below, that I want to be able to call like I want to call the method like add/1
:
@Controller()
export class MyController {
@Post('add/:id')
async add(@Body() data: MyData, @Query('id') id?: number) {
console.log(id);
//...
}
}
Is it possible to achieve without modifying the Controller
like Controller('add')
?
try change @Query
to @Param
@Post('add/:id')
async add(@Body() data: MyData, @Param('id') id?: number) {
console.log(id);
//...
}