最佳答案
您可以处理错误,而不是默认行为(将错误发送到客户端)。使用回调并检查错误。如果有任何错误,则不要显示它们,而是显示如下错误页面。
res.render(your_template, {}, function(err, html) {
if(err) {
res.redirect('/error');
} else {
res.send(html);
}
});
引用号:How do I turn off Node.js Express (ejs template engine) errors for production?
关于node.js - 防止 Express 向 Jade 模板显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45850807/