import { Module } from '@nestjs/common'; import { DataSource } from 'typeorm'; import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm'; // DEBUG: Is this necessary? Docs unclear. import { AppController } from './app.controller'; import { AppService } from './app.service'; import { Cat } from './cats/cats.entity'; import { CatsModule } from './cats/cats.module'; let dbConfig: TypeOrmModuleOptions; if ( process.env.NODE_ENV === 'production' ) { dbConfig = { type: 'sqlite', database: 'database/database_development.sqlite3' } } else { dbConfig = { type: 'sqlite', database: 'database/database_development.sqlite3', entities: [Cat], } } @Module({ imports: [TypeOrmModule.forRoot(dbConfig), CatsModule], controllers: [AppController], providers: [AppService], }) export class AppModule {}