Here I am trying to access redirect on login route by same route, first i am calling homeCtrl function ,after this function successfully render i want to exceute res.redirect('/login'),
but here follow error is occured-:
Error: Can't set headers after they are sent.
router.get('/email_authentication', homeCtrl,function(req,res){
res.redirect('/login');
});
function homeCtrl(req, res,next) {
res.render('email_authentication');
return next();
}
please guide me how to do this if any other solution please help me.