post请求,发body json格式数据,通过body拿到数据,状态响应是201,跟tornado全部200有些不一样,更接近restful标准
This commit is contained in:
parent
028c2771d1
commit
aea8856148
|
@ -1,4 +1,4 @@
|
|||
import { Controller, Get, Req, Query, Headers, Param } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Req, Query, Headers, Param, Body } from '@nestjs/common';
|
||||
|
||||
@Controller('posts')
|
||||
export class PostsController {
|
||||
|
@ -19,4 +19,10 @@ export class PostsController {
|
|||
title: `Post ${params.id}`
|
||||
}
|
||||
}
|
||||
|
||||
@Post()
|
||||
store(@Body() body) {
|
||||
console.log(body)
|
||||
return body
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue