I am creating a new user and saving it in my DB as shown below:
const user= new User({
username: userId,
password: pass,
nameOfUser: user_name,
emailOfUser: user_email
);
user.save();
res.redirect("/redirectpage");
setTimeout(function(){
res.redirect("/");
},5000);
After saving the user I am trying to create a countdown redirect page. It looks something like:
After this, counter (of 5 seconds) reaches 0, I intend to redirect the user to the login page which is the home route. I implemented this through setTimeout. But unfortunately my app crashes giving the following errors: (** Note: If i comment out res.redirect("/redirectpage"), no errors are shown)