draft数据保存
react 富文本内容draft数据保存
后台使用node
node 访问mysql数据库的server.js实现
let mysql = config.mysql;
console.log("save");
let insertSql = 'INSERT INTO zhunti_article (title, content) VALUES (' + req.body.title +"," + JSON.stringify(req.body.content) + ')';
console.log(insertSql);
let sqltest = 'INSERT INTO zhunti_article (title, content) VALUES ( "aa1", "bb")';
connection.query(insertSql, function (error, result, fields) {
console.log(error)
if(error) throw error;
} );
connection.query(sql, function (error, results, fields) {
if (error) throw error;
console.log('The solution is: ', results[0].id);
});
let result = {
result : 'success'
}
res.json(result);