import { Body , Controller , Delete , Get , Param , Post } from '@nestjs/common' ; import { CatDTO } from './cat.dto' ; import { Cat } from './cat.model' ; import { CatsService } from './cats.service' ; @ Controller ( 'cats' ) export class CatsController { constructor ( private readonly catsService ) { } @ Get ( ) async getCats ( ) { return this . catsService . getCats ( ) ; } @ Get ( ':id' ) async findOne ( @ Param ( 'id' ) id ) { return this . catsService . getCat ( id ) ; } @ Post ( 'new' ) async newCat ( @ Body ( ) cat ) { return this . catsService . addCat ( cat ) ; } @ Delete ( ':id' ) async remove ( @ Param ( 'id' ) id ) { return this . catsService . removeCat ( id ) ; } }