nodly
Version:
Nodly is an interactive CLI for scaffolding modern Node.js/Express.js backend projects with instant setup for databases, mailers, queues, sockets, and more. Skip boilerplate and start building features fast.
23 lines (20 loc) • 520 B
JavaScript
import 'reflect-metadata';
import { DataSource } from 'typeorm';
export const AppDataSource = new DataSource({
type: 'postgres',
url: process.env.TYPEORM_DATABASE_URL,
synchronize: true,
logging: false,
entities: [], // Add your entities here
migrations: [],
subscribers: [],
});
export const initTypeORM = async () => {
try {
await AppDataSource.initialize();
console.log('TypeORM connected');
} catch (error) {
console.error('TypeORM connection error:', error);
throw error;
}
};