Proper usage of Express' res.render() and res.redirect()
问题 I am using a res.redirect('page.ejs'); and on my browser I get the message: Cannot GET /page.ejs I have not declared this in my routes file in the style of : app.get('/page', function(req, res) { res.render('page.ejs'); }); Should this be included in order for the res.redirect() to work? When I do not use res.redirect() but res.render() , even if I have not the app.get() code, it still works. 回答1: so to understand this, let's look at what each of these methods do. res.redirect('page.ejs');