Create a new git branch called week6. This should be created when the week5 branch is active, so that it adds to week 5. Continue to work in the node-express-course/03-task-manager/starter directory. You duplicate the work of the instructor in the video.
Create a file in the starter directory called QuizAnswers2.txt. Put answers to the following questions in it.
const getTask = asyncWrapper(async (req, res, next) => {
const { id: taskID } = req.params;
const task = await Task.findOne({ _id: taskID });
if (!task) {
// your code here
}
res.status(200).json({ task });
});
As you will see in the lessons that follow, you do not have to create the asyncWrapper middleware, because you can instead use an NPM package called express-async-errors that provides the capability.