0 points

Mongoose Validation to front end


dashboard

Mon Aug 17 2020 15:51:22 GMT+0000 (UTC)

Posted by @brainyworld #nodejs #javascript

const mongooseValidation = (theError) => {
    const errors = {}
    const details = errors.theError
    for (const key in details)
    {
        errors[key] = [details[key].message]
    }
    return errors
}

module.exports = mongooseValidation
content_copy Copy

This is used to popup validation to front end