add db
This commit is contained in:
parent
4300e851df
commit
d264b515a1
@ -1,10 +1,12 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
|
|
||||||
|
import { database } from './config';
|
||||||
|
|
||||||
import { ContentModule } from './modules/content/content.module';
|
import { ContentModule } from './modules/content/content.module';
|
||||||
import { CoreModule } from './modules/core/core.module';
|
import { CoreModule } from './modules/core/core.module';
|
||||||
import { DatabaseModule } from './modules/database/database.module';
|
import { DatabaseModule } from './modules/database/database.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [ContentModule, CoreModule.forRoot(), DatabaseModule],
|
imports: [ContentModule, CoreModule.forRoot(), DatabaseModule.forRoot(database)],
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
12
src/config/database.config.ts
Normal file
12
src/config/database.config.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||||
|
|
||||||
|
export const database = (): TypeOrmModuleOptions => ({
|
||||||
|
charset: 'utf8mb4',
|
||||||
|
logging: ['error'],
|
||||||
|
type: 'mysql',
|
||||||
|
host: '192.168.50.26',
|
||||||
|
port: 3306,
|
||||||
|
username: '3r',
|
||||||
|
password: '12345678',
|
||||||
|
database: '3r',
|
||||||
|
});
|
1
src/config/index.ts
Normal file
1
src/config/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './database.config';
|
Loading…
Reference in New Issue
Block a user