NodeJs使用Mysql模块实现事务处理实例?
先npm install mysql
然后代码中就可以require('mysql');
就可以使用了
var mysql = require('mysql');var pool = mysql.createPool(config);pool.getConnection(function(err, connection) {// Use the connectionconnection.query( 'SELECT something FROM sometable', function(err, rows) {// And done with the connection.connection.end();// Don't use the connection here, it has been returned to the pool.});});
js代码透明,你在写好代码提交给别人的时候,或是部署的时候,用
Jshaman
给代码加密一下,别人就看不了你的代码了
版权说明:Copyright © 广州松河信息科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州松河信息科技有限公司 版权所有