-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
qingtu
authored and
qingtu
committed
Aug 11, 2021
1 parent
87f1036
commit 4836dda
Showing
6 changed files
with
77 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,61 @@ | ||
import { Controller } from '@nestjs/common'; | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { CatsService } from './cats.service'; | ||
import Data from '../interfaces/data'; | ||
|
||
@Controller('cats') | ||
export class CatsController {} | ||
export class CatsController { | ||
constructor(private readonly catsService: CatsService) {} | ||
|
||
@Get() | ||
findAll(): string { | ||
return this.catsService.findAll(); | ||
} | ||
|
||
@Get('/data') | ||
findDataSource(): Data[] { | ||
return [ | ||
{ | ||
key: '1', | ||
name: 'John Brown', | ||
age: 32, | ||
address: 'New York No. 1 Lake Park', | ||
tags: ['nice', 'developer'], | ||
}, | ||
{ | ||
key: '2', | ||
name: 'Jim Green', | ||
age: 42, | ||
address: 'London No. 1 Lake Park', | ||
tags: ['loser'], | ||
}, | ||
{ | ||
key: '3', | ||
name: 'Joe Black', | ||
age: 32, | ||
address: 'Sidney No. 1 Lake Park', | ||
tags: ['cool', 'teacher'], | ||
}, | ||
{ | ||
key: '4', | ||
name: 'John Brown', | ||
age: 32, | ||
address: 'New York No. 1 Lake Park', | ||
tags: ['nice', 'developer'], | ||
}, | ||
{ | ||
key: '5', | ||
name: 'Jim Green', | ||
age: 42, | ||
address: 'London No. 1 Lake Park', | ||
tags: ['loser'], | ||
}, | ||
{ | ||
key: '6', | ||
name: 'Joe Black', | ||
age: 32, | ||
address: 'Sidney No. 1 Lake Park', | ||
tags: ['cool', 'teacher'], | ||
}, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class CatsService {} | ||
export class CatsService { | ||
findAll(): string { | ||
return 'some cats'; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
interface Data { | ||
key: string; | ||
name: string; | ||
age: number; | ||
address: string; | ||
tags: string[]; | ||
} | ||
|
||
export default Data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters