Created
August 24, 2020 11:25
-
-
Save nmchenry01/7240e68c4a13a8fc8de98a248dd9552e to your computer and use it in GitHub Desktop.
Beginning task controller "NestJS with Swagger"
This file contains hidden or 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
| @Controller('task') | |
| export class TaskController { | |
| constructor(private readonly taskService: TaskService) { } | |
| @Get() | |
| getTasks(): Task[] { | |
| return this.taskService.getTasks(); | |
| } | |
| @Get(':id') | |
| getTask(@Param('id') taskId: string): Task { | |
| return this.taskService.getTask(taskId); | |
| } | |
| @Post() | |
| createTask(@Body() createTask: CreateTask): Task { | |
| return this.taskService.createTask(createTask) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment