0 points

Store Mongoose validations on session


dashboard

Mon Aug 17 2020 15:53:41 GMT+0000 (UTC)

Posted by @brainyworld #nodejs #javascript

const flashMsg = (req, res, next) => {
    if (req.session.flashData) {
        for (const key in req.session.flashData) {
            res.locals[key] = req.session.flashData[key]
        }

        req.session.flashData = null
    }
     
    next()
}

module.exports = flashMsg
content_copy Copy