When you interact with DB, always send an Object. In this case, u need to send name, phone and crazy in the object.
app.post('/new_contact', function(req, res){
var name = req.body.name;
var phone = req.body.phone;
db.insert(({name:name, phone:phone, crazy:true}), phone, function(err,header ){
if(err){
res.send("Error creating database "+ req.body.dbname);
return;
}
return res.send("contact created successfully");
})
})
* Be the first to Make Comment