1.路由传参
app.controller.ts
TypeScript
import { Controller , Get , Param } from "@nestjs/common"
import { AppService } from "./app.service";
@Controller()
export class AppController {
construstor(private readonly appService: AppService){}
@Get(":id")
getHello(@param("id") id: number){
return id;
}
}
请求 http://localhost:3000/2 -> 2