sails req.flash

req.flash是用在controller向view传递消息,比如登录验证的错误,操作错误

例如在controller定义消息error: req.flash(‘error’, ‘error message…’)
在view获取消息:
通过req.session.flash.error可以多次获取,
通过req.flash(‘error’)获取后消息立即消失,req.session.flash.error也消失