try change @Query to @Param
@Query
@Param
@Post('add/:id') async add(@Body() data: MyData, @Param('id') id?: number) { console.log(id); //... }