I have a sign-up page where i collect form data. How would i serve the next page after signup and checking is complete?
I serve the page using
app.get("/Register",(req,res)=>{
res.sendFile("Register.html",{root:path.dirname(notes)});
//res.sendFile("supporter.html",{root:path.dirname(support)});
})
I collect the data using
app.post("/Data",async(req,res)=>
{//function here somewhere
person.fname=await req.body.name1;
person.lname=await req.body.name2;
person.email=await req.body.email;
person.passwrd=await req.body.psswrd;
person.Type=await req.body.type;
//let s=false;
sent=true;
console.log(person);
//console.log(sent);
insert();
//mongo db connection
swi1=false;
//res.sent;
let next=await req.body.click;
killswi=true;
});
After the post i would like to serve the next page. Every time i do i get 404 not found. Which is why i tried to turn the app.post into a async function. Because i have variables i need to collect from the regiter page. I need to wait for the data to come through before i can serve it.
So if i dont write
app.get("/supporter",(req,res)=>{
//res.sendFile("supporter.html",{root:path.dirname(notes)});
res.sendFile("supporter.html",{root:path.dirname(support)});
})
In the above post it serves the supporter page without collecting the data from the register page. How would i go about fixing this problem.Is there something i am missing?