Open soon530 opened 2 years ago
新增一個route http://localhost:3000/cats
import { Controller, Get } from '@nestjs/common';
@Controller('cats')
export class CatsController {
@Get()
findAll(): string {
return 'This action returns all cats';
}
}
要加到這裡來,不然抓不到~
@Module({
imports: [],
controllers: [AppController, CatsController],
providers: [AppService],
})
官網難看,改看 #8
直接下指定快快的,架構也幫忙放好好的。
% nest generate controller todo
CREATE src/todo/todo.controller.spec.ts (478 bytes)
CREATE src/todo/todo.controller.ts (97 bytes)
UPDATE src/app.module.ts (322 bytes)
https://docs.nestjs.com/controllers