[英]How to pass REST parameters of a function in Postman body
Hello I'm writing a numbers multiplication code in NestJS where I pass REST parameters in a function.你好,我正在 NestJS 中编写一个数字乘法代码,我在函数中传递 REST 参数。 But I don't know how do I pass REST parameters in postman during API call.
但我不知道如何在 API 调用期间在邮递员中传递 REST 参数。
There are several ways to achieve that, I'm just going to give an example of some of the most used.有几种方法可以实现这一点,我将举一个最常用的例子。
Path Params路径参数
and your NestJS function (Controller) ex:和您的 NestJS 函数(控制器)例如:
@Put(':id')
update(@Param('id') id: string) {
...
}
Query Params查询参数
NestJS function (Controller) ex: NestJS 函数(控制器)例如:
@Get()
getData(@Query() params: paramsDto) {
...
}
Body Params身体参数
NestJS function (Controller) ex: NestJS 函数(控制器)例如:
@Post()
create(@Body() params: paramsDto) {
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.