×

Html & Html5

The World's best Software Development Study Portal




Node Js Post Method:



//creater a Post method for Node Js in app.js File.

app.post("/register",async(req,res)=>{
try{
const registerEmp= new Register({
fullName:req.body.fullName,
username:req.body.username,
email:req.body.email,
password:req.body.password
})
const registered= await registerEmp.save();
console.log(registered)
res.status(201).render("index");
}catch(error){
res.status(400).send(error)
}
});