下面是我注册用户的代码。在安装必要的模块之后。 express-flash-2和express-session。下面的代码给了我错误" req.flash不是函数"。我可以采取任何方式吗?
router.post('/register', function(req, res) {
var db = firebase.database();
var email = req.body.email;
var name = req.body.name;
var username = req.body.username;
var password = req.body.password;
if(email === "" || name === "" || username === "" || password === "") {
req.flash('msg', 'All fields are required.');
res.redirect('/signup');
} else {
console.log('register successfully');
}
});