Soy nuevo en nodejs y mysql . Quiero insertar algunos datos en la base de datos mysql usando nodejs . Intenté hacerlo con y sin módulos mysql-crud pero fallé. ¿Alguien puede ayudarme?
exports.insertquotereq = function(req, res){ var chat_data = { to_country: req.whereto, to_airport: req.toairport, from_country: req.fromwhere, from_airport: req.fromairport, planetype: req.planetype, startdate: req.startdate, starttime: req.starttime, returndate: req.returndate, returntime: req.returndate, email: req.email, distance: req.distance, estimatedhrs: req.estimatedhrs, planecostperhr: req.planecostperhr, estimatedcost: req.estimatedcost, estimated_time: req.estimated_time }; //console.log('chat_data',chat_data); var insert = connection.query("INSERT INTO chat SET ?", chat_data, function(err, result){ if(err) throw err; console.log('data inserted'+insert); }); };