简体   繁体   English

如何在 Postman 正文中传递函数的 REST 参数

[英]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.

相关问题 Typescript/JavaScript - 如何将 rest 参数作为参数而不是数组传递给后续的 function? - Typescript/JavaScript - How to pass rest parameters to subsequent function as parameters and not as array? 如何将function和function中的function和arguments作为参数传递给typescript - How to pass function and arguments of that function as parameters in typescript Typescript-如何将函数指针传递给函数并在函数体内调用 - Typescript - How to pass function pointer into function and call within function body 如何将附加参数传递给 React 中的 onChange 函数 - How to pass additional parameters to onChange function in React 如何传递带有参数的 function 与 typescript 反应 - How to pass a function with parameters in react with typescript 如何将参数从html传递给typescript function? - How to pass parameters to a typescript function from html? 如何将两个参数传递给 function 或在 typescript 中不传递? - How to pass two parameters into function or none in typescript? Angular 2中如何分别传2个参数给EventEmitter传给function? - How to pass 2 parameters separately to the EventEmitter to pass them to function in Angular 2? 如何在不使用函数参数的情况下将值传递给函数? - How can I pass a value into a function without using function parameters? 在 function 调用期间,如何在 Typescript 中使用 rest 参数? - During a function call how can I use rest parameters in Typescript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM