Skip to content

Commit

Permalink
use task model in controlle
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaalanMarwan committed Apr 28, 2022
1 parent 86cff01 commit cc8a46e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/tasks/tasks.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Controller, Post } from '@nestjs/common';
import { Controller, Get, Post } from '@nestjs/common';
import { Task } from 'src/tasks/task.model';
import { TasksService } from 'src/tasks/tasks.service';

@Controller('tasks')
export class TasksController {
constructor(private tasksService: TasksService) {}

@Get('')
getTasks(): Task[] {
return this.tasksService.getTasks();
}
}
9 changes: 8 additions & 1 deletion src/tasks/tasks.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Injectable } from '@nestjs/common';
import { Task } from 'src/tasks/task.model';

@Injectable()
export class TasksService {}
export class TasksService {
private tasks: Task[] = [];

getTasks() {
return this.tasks;
}
}

0 comments on commit cc8a46e

Please sign in to comment.