import "reflect-metadata" import { DataSource } from "typeorm" import { PostgresConnectionOptions } from "typeorm/driver/postgres/PostgresConnectionOptions" import { env } from '../env' export const PostgresDataSource = new DataSource({ url: env.DATABASE_URL, type: 'postgres', entities: [__dirname + '/entities/*.{js,ts}'] } as PostgresConnectionOptions) export const dbinitialize = async () => { PostgresDataSource .initialize() .then(() => { console.log("Postgres Data Source has been initialized!") }) .catch((err) => { console.error("Error during Data Source initialization:", err) }) }