标签:user 5.0 query ade create 请求 cli username uri
yarn global add @nestjs/cli
nest new NestJS
import { Get, Post,Controller, Header, Query, Body, Req } from '@nestjs/common';
@Controller('login')
export class AppController {
@Get() // get请求 http://localhost:3000/login
@Header('access-control-allow-origin', '*')
@Header('X-username', 'Ajanuw')
root(
@Req() req,
@Query('name') username): string {
return 'Hello World!';
}
@Post('post') // http://localhost:3000/login/post
create(@Body() body) {
console.log( body); // post来的数据
}
}
@Get(':id')
findOne(@Param() params) {
console.log(params.id);
return {};
}
标签:user 5.0 query ade create 请求 cli username uri
原文地址:https://www.cnblogs.com/ajanuw/p/8850050.html