Node.js EJS中的打印错误
我在EJS中有打印错误的问题,因为当我在EJS中使用时,我被引导到错误404 not found。有人能告诉我它是怎么打印出来的吗Node.js EJS中的打印错误,node.js,ejs,Node.js,Ejs,我在EJS中有打印错误的问题,因为当我在EJS中使用时,我被引导到错误404 not found。有人能告诉我它是怎么打印出来的吗 req.checkBody('login', 'Login is required').notEmpty(); req.checkBody('password', 'Password is required').notEmpty(); var errors = req.validationErrors(); if (errors) { con
req.checkBody('login', 'Login is required').notEmpty();
req.checkBody('password', 'Password is required').notEmpty();
var errors = req.validationErrors();
if (errors) {
console.log(errors)
res.render('index', {
errors: errors
});
你需要先初始化错误。例如:res.render'index',{errors:null};在索引页的get方法中