const typeorm = require("typeorm");
const connectionManager = require("typeorm").getConnectionManager();
const connected = connectionManager.has("default");
if(!connected){
connectionManager.create({
type: "mysql",
host: "oo.xx.oo.xx",
port: 3306,
username: "root",
password: "ooxxooxx",
database: "ooxxdb",
synchronize: false,
logging: true,
ssl: SSL,
keepConnectionAlive: false,
});
}
try {
db = connectionManager.get();
if(!connected){
await db.connect();
console.log('connect .... OK!');
}
}catch(error) {
console.log("TypeORM Error: ", error);
};
var ranks = await db.query("select * from users");