()
getHello(): string {
return this.appService.getHello();
}
}
使用@Controller装饰器来定义控制器, @Get...(): string {
return this.appService.getHello();
}
}
然后重新启一下服务,此时再去访问http://localhost:9080/会发现404.../posts.service';
import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common...*/
@Get(':id')
async findById(@Param('id') id) {
return await this.postsService.findById.../swagger';
import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common';