Nodejs Express Return Error Code with Res.Render
check these:
app.use(function(req, res) {
res.status(404);
url = req.url;
res.render('404.jade', {title: '404: File Not Found', url: url });
});
// Handle 500
app.use(function(error, req, res, next) {
res.status(500);
url = req.url;
res.render('500.jade', {title:'500: Internal Server Error', error: error, url: url});
});
I cannot find confirmation in Express docs but using:
res.status(statusCode).render(page)
Status and render the page correctly.
express: "4.17.1"