37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { ProfesorModule } from './Profesor/profesor.module';
|
|
import { ProfesorController } from './Profesor/profesor.controller';
|
|
import { ProfesorService } from './Profesor/profesor.service';
|
|
import { Module } from '@nestjs/common';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { AppController } from './app.controller';
|
|
import { AppService } from './app.service';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { join } from 'path';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
envFilePath:".env",
|
|
isGlobal: true,
|
|
})
|
|
,TypeOrmModule.forRootAsync({
|
|
imports:[ConfigModule],
|
|
inject:[ConfigService],
|
|
useFactory: async(configservice:ConfigService)=>({
|
|
type: "mariadb",
|
|
host: configservice.get("DB_HOST"),
|
|
port: configservice.get("DB_PORT"),
|
|
username: configservice.get("DB_USER"),
|
|
password: configservice.get("DB_PASSWORD"),
|
|
database: configservice.get("DB_DATABASE"),
|
|
entities: [],
|
|
synchronize: configservice.get("DB_SYNCRONIZE")
|
|
})
|
|
}),ProfesorModule],
|
|
controllers: [
|
|
ProfesorController, AppController],
|
|
providers: [
|
|
ProfesorService, AppService],
|
|
})
|
|
export class AppModule { }
|