I'm following a node/express course and the instructure has written the below error handler code and I get the error:
Unexpected block statement surrounding arrow body; move the returned value immediately after the =>
.eslintarrow-body-style
Any ideas how to fix it?
const catchAsync = fn => {
return (req, res, next) => {
fn(req, res, next).catch(next)
}
}
exports.createTour = catchAsync(async (req, res, next) => {
const newTour = await Tour.create(req.body);
res.status(201).json({
status: 'success',
data: {
tour: newTour
}
})
})
Solved! Go to Solution.
Hello round2314,
This error seems to be related to JavaScript. Being in the Canvas Community we can answer questions related to Canvas, although it seems your questions is a little outside of our scope. I would recommend to ask your instructor for questions related to the course material.
Hello round2314,
This error seems to be related to JavaScript. Being in the Canvas Community we can answer questions related to Canvas, although it seems your questions is a little outside of our scope. I would recommend to ask your instructor for questions related to the course material.