app.use(function(req, res, next) {
if(res.status === 404){
res.status(404).sendFile(path.join(__dirname, '../website/404.html'));
}
else{
res.status(500).sendFile(path.join(__dirname, '../website/500.html'));
}
});
`为什么它只运行 500 错误而不是抛出 404 错误。它改变了 t0 500 错误
正确的语法是什么`
与 404 或 500 比较时使用
res.statusCode
,而不是 res.status
。