How to create a connection pool using TypeOrm? While exploring TypeOrm, I wanted to create pool of connections for working with MySql
Below is the code snippet :
import { createConnection } from 'typeorm';
export const databaseProviders = [
{
provide: 'DbConnectionToken',
useFactory: async () => await createConnection({
type: 'mysql',
host: 'localhost',
port: 8889,
username: 'root',
password: 'root',
database: 'typeorm_test',
entities: [
__dirname + '/../**/**.entity{.ts,.js}',
],
autoSchemaSync: true,
logging: 'all',
}),
},
];