ZhelinCheng / BlogComments

个人博客评论
0 stars 0 forks source link

Nest.js学习笔记 - ZHE LIN #14

Closed ZhelinCheng closed 1 year ago

ZhelinCheng commented 5 years ago

https://zhelin.me/post/523e5859795170ae/

控制器Controller @Controller() 装饰 使用 import { Controller, Get } from '@nestjs/common'; @Controller('cats') export class CatsController { @Get() findAll(): string { return 'This action returns all cats'; } } Providers/Services @Injectable() 装饰 使用 import { CatsService } from './cats.service'; // 构造函数参数可以使用 @Inject(CatsService) 装饰器 // 控制器 @Controller('cat') export class CatController { constructor( private readonly catService: