-
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
1 parent
f8d0b3c
commit 91e4700
Showing
2 changed files
with
23 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { Controller, Get, Param } from '@nestjs/common'; | ||
import { PostService } from './post.service'; | ||
|
||
@Controller('post') | ||
export class PostController { | ||
constructor(private readonly postService: PostService) {} | ||
|
||
@Get() | ||
async getPosts() { | ||
const posts = await this.postService.getPosts(); | ||
return posts; | ||
} | ||
|
||
@Get('/:id') | ||
async postDetails(@Param('id') id: number) { | ||
const post = await this.postService.findPostById(id); | ||
return post; | ||
} | ||
} |
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