node.js - Nodejs Express Return Error Code with Res.Render -
i using nodejs express. return custom 404 not found error page. have working. have not found solution of how return error code res.render(). saw few similar questions old , using deprecated methods. appreciated.
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}); });
Comments
Post a Comment