Created
July 6, 2020 20:02
-
-
Save nmchenry01/fb1063bf1114eb646c7b55b2daeb6a62 to your computer and use it in GitHub Desktop.
Task Controller V2 for "Why you should use NestJS for your next project" Blog
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
import { Controller, Get, Post } from '@nestjs/common'; | |
import { TaskService } from './task.service'; | |
import { Task } from './models/task.entity'; | |
@Controller('task') | |
export class TaskController { | |
constructor(private taskService: TaskService) {} | |
@Post() | |
createTask(@Body() task: Task): void { | |
return this.taskService.createTask(task); | |
} | |
@Get() | |
findAllTasks(): Task[] { | |
return this.taskService.findAllTasks(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment