Skip to content

Instantly share code, notes, and snippets.

@nmchenry01
Created August 24, 2020 11:25
Show Gist options
  • Select an option

  • Save nmchenry01/7240e68c4a13a8fc8de98a248dd9552e to your computer and use it in GitHub Desktop.

Select an option

Save nmchenry01/7240e68c4a13a8fc8de98a248dd9552e to your computer and use it in GitHub Desktop.
Beginning task controller "NestJS with Swagger"
@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