mysql-bluebird

Bluebird wrapper for MySQL

Usage no npm install needed!

<script type="module">
  import mysqlBluebird from 'https://cdn.skypack.dev/mysql-bluebird';
</script>

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);
  });