Skip to content

Simple wrapper with additional functionality over node-mysql.

License

Notifications You must be signed in to change notification settings

wcoder/node-mysql-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-mysql-wrapper

Simple wrapper with additional functionality over node-mysql.

Install

npm i node-mysql-connect --save

Using

Minimal config:

var config = {
	user: '<your_user>',
	password: '<your_password>',
	database: '<your_database_name>'
};

Include and initialize module:

var connection = require('node-mysql-connect')(config);

Do query:

connection.query("SELECT * FROM <your_table>", function (err, data) {
	if (err) throw err;

	// working with data ...
});

Query with params:

connection.query("SELECT * FROM <your_table> WHERE a = ? AND b = ?", [a, b], function (err, data) {
	if (err) throw err;

	// working with data ...
});

Configuration

logger - enable logging:

var config = {
	//...
	logger: console.log // for example
};

About

Simple wrapper with additional functionality over node-mysql.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published