typeormmodule unable to connect to the database postgres heroku
add this props to your cnf object:
ssl: true,
extra: {
ssl: {
rejectUnauthorized: false,
},
},
//
const cfg: TypeOrmModuleOptions = {
---> Add here!!! <---
type: 'postgres',
host: process.env.DB_HOST,
database: process.env.DB_NAME,
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
port: Number(process.env.DB_PORT),
};
@Module({
imports: [TypeOrmModule.forRoot(cfg)],
})
export class AppModule {}