you can't pass data with res.redirect()
but you can pass your data with queries or params for example :
router.get('/sayhelloandhi',(req,res) => {
res.redirect('/?data=error');
});
router.get('/',(req,res) => {
let {data} = req.query;
res.render('index', {data})
});
and with params :
router.get('/sayhelloandhi',(req,res) => {
res.redirect('/error');
});
router.get('/:data',(req,res) => {
let {data} = req.params;
res.render('index', {data})
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…