Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
'use strict';
const mysql = require('mysql');
const Prom = require('bluebird');
let pool = mysql.createPool({
host: 'localhost',
user: 'user',
password: 'password',
database: 'database'
let getPoolConnection = () => pool.getConnectionAsync().disposer(
connection => connection.destroy()
let query = command => Prom.using(getPoolConnection(),
connection => connection.queryAsync(command)
module.exports = {
query: query,
escape: mysql.escape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment