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
const Task = require('../models/Task'); | |
//logic for displaying tasks on home page | |
const task_board = (request, response)=>{ | |
Task.find().sort({createdAt: -1}) | |
.then((result)=>{ | |
response.render('taskBoard',{title:'All tasks', tasks:result}) | |
console.log('got tasks from db successfully') | |
}) | |
.catch(error =>console.log(error)); | |
} |