How to use the default function from mysql2

Find comprehensive JavaScript mysql2.default code examples handpicked from public code repositorys.

82
83
84
85
86
87
88
89
90
91
module.exports = /** @class */ (function (_super) {
    __extends(Db, _super);
    function Db() {
        var _this_1 = _super.call(this) || this;
        _this_1.MysqlStore = _this_1.mysql_session;
        _this_1.mysql = mysql2_1.default;
        _this_1.__ = Singleton_1.Singleton.getLodash();
        _this_1.connection_configurations = {
            // Host name for database connection:
            host: config.configurations().host,
fork icon1
star icon1
watch icon1

+ 14 other calls in file

50
51
52
53
54
55
56
57
58
59
Object.defineProperty(exports, "__esModule", { value: true });
exports.db = void 0;
const mysql2_1 = __importDefault(require("mysql2"));
const dotenv = __importStar(require("dotenv"));
dotenv.config();
exports.db = mysql2_1.default.createConnection({
  host: process.env.DB_HOST,
  // port: process.env.DB_PORT,
  user: process.env.DB_USER,
  password: process.env.DB_PWD,
fork icon0
star icon1
watch icon1

+ 2 other calls in file

55
56
57
58
59
60
61
62
63
64
        update: true,
        token: req.session.token,
        maxAge: req.session.cookie.originalMaxAge
    });
});
const pool = mysql2_1.default.createPool({
    host: 'localhost',
    user: env.MYSQL_USER,
    password: env.MYSQL_CONNECTION_PASS,
    database: env.MYSQL_CONNECTION_DATABASE,
fork icon0
star icon0
watch icon1

+ 2 other calls in file

44
45
46
47
48
49
else {
    console.log('Running from localhost. Connecting to DB directly.');
    // @ts-ignore
    config.host = process.env.DB_HOST;
}
exports.db = mysql2_1.default.createConnection(config);
fork icon0
star icon0
watch icon1