what happens here how does it recieve data from a client. Is it simlar to an async function?
app.post("/Data",(req,res) =>{//function here somewhere
person.fname=req.body.name1;
person.lname=req.body.name2;
person.email=req.body.email;
person.passwrd=req.body.psswrd;
person.Type=req.body.type;
let s=false;
});
I was thinking of something like this
app.post("/Data",async function front(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;
});
//Then call the front() in another async which connects to a db collection like this await front()
Will this work? I have problems readind from the front and sellecting the collection. The collection is a radio button selected on the client side and it has to be changed from and to on the server side. So how does the app.post handle data?