Closed aeksco closed 6 years ago
Update the handleError function to return { error: err } and set status manually, like so:
handleError
{ error: err }
status
// Return a standard error export const handleError = (res, err) => { return res.status(500).json({ error: err }).end() }
Repeat this process for the validationError function.
validationError
Additionally:
var
let
const
if(err){ ...
if (err) { ...
"
'
function
=>
ClassYear.findOne({"dayCodes.code":code}) .exec(function(err, classYear){ ... })
becomes:
ClassYear.findOne({"dayCodes.code":code}) .exec((err, classYear) => { ... })
Resolved
Update the
handleError
function to return{ error: err }
and setstatus
manually, like so:Repeat this process for the
validationError
function.Additionally:
var
statements with eitherlet
orconst
.if(err){ ...
should beif (err) { ...
)"
(double quote) with'
(single quotes)function
keyword with=>
function syntax, i.e.: this:becomes: