二建小科普为您分享以下优质知识
先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
给代码加密一下,别人就看不了你的代码了
评论列表(4条)
我是公众科技网的签约作者“二建小科普”!
希望本篇文章《NodeJs使用Mysql模块实现事务处理实例》能对你有所帮助!
本站[公众科技网]内容主要涵盖:教育,学历提升
本文概览:先npm install mysql然后代码中就可以require('mysql');就可以使用了u00