Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wcoder/node-mysql-connect

Simple wrapper with additional functionality over node-mysql.
https://github.com/wcoder/node-mysql-connect

javascript mysql node-mysql nodejs wrapper

Last synced: 14 days ago
JSON representation

Simple wrapper with additional functionality over node-mysql.

Awesome Lists containing this project

README

        

# node-mysql-wrapper

Simple wrapper with additional functionality over node-mysql.

## Install
```
npm i node-mysql-connect --save
```

## Using
Minimal config:
```js
var config = {
user: '',
password: '',
database: ''
};
```
Include and initialize module:
```js
var connection = require('node-mysql-connect')(config);
```
Do query:
```js
connection.query("SELECT * FROM ", function (err, data) {
if (err) throw err;

// working with data ...
});
```
Query with params:
```js
connection.query("SELECT * FROM WHERE a = ? AND b = ?", [a, b], function (err, data) {
if (err) throw err;

// working with data ...
});
```

## Configuration
`logger` - enable logging:
```js
var config = {
//...
logger: console.log // for example
};
```