Mongoose Validation to front end

PHOTO EMBED

Mon Aug 17 2020 15:51:22 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

This is used to popup validation to front end