提示:error is not defined,这是什么原因造成的呢?
我在app.js中已经引入了
在index.js中也有写了返回error错误信息
就是找不到原因在哪!求高人指点迷津…
app.js 里加多一个 middleware // set flash app.use(function (req, res, next) { res.locals.errors = req.flash(‘error’); res.locals.infos = req.flash(‘info’); next(); });
然后在视图模板里面遍历 errors
@IchiNiNiIchi 问题得到了解决,谢谢!
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
app.js 里加多一个 middleware // set flash app.use(function (req, res, next) { res.locals.errors = req.flash(‘error’); res.locals.infos = req.flash(‘info’); next(); });
然后在视图模板里面遍历 errors
@IchiNiNiIchi 问题得到了解决,谢谢!