mysql-bluebird
v0.0.3
Published
Bluebird wrapper for MySQL
Downloads
11
Readme
MySQL Bluebird
Bluebird wrapper for MySQL
Installation
You can install this module via npm:
npm install mysql-bluebird
Example Usage
// Require the module.
var MySQL = require('mysql-bluebird');
var Promise = require('bluebird');
// Pass your connection options to the constructor.
var db = new MySQL({
"host": "127.0.0.1",
"port": 3306,
"database": "name",
"user": "user",
"password": "password"
});
Promise.resolve()
.then(function () {
// Call the start function which will connect to the database.
return db.start();
}).then(function () {
// Perform a query to the database to get all the rows from the test table.
return db.query('SELECT * FROM test');
}).then(function (res) {
// Console print the returned rows.
console.log(res);
});