I have my bbdd defined here:
export default{
database: {
host: 'localhost',
user: 'root',
password: '',
dabatase: 'nominas'
}
}
I attempt to do the connection in another file:
import mysql, { Connection } from 'promise-mysql';
import keys from './keys';
const pool = mysql.createConnection(keys.database);
pool.getConnection(any)
.then (Connection => {
pool.releaseConnection(Connection);
console.log('DB is connected');
});
export default pool;
The problem is that the createConnection function returns a value type: Bluebird, and I cann't do functions like releaseConnection, and getConnection on it, and not add, update or list bbdd data. Can anybody help me? I'm using the latest version of visual studio code and typescript.