增加数据库配置

This commit is contained in:
Jeremy Yin 2019-06-26 21:21:08 +08:00
parent efc2091869
commit 833274304f
1 changed files with 13 additions and 1 deletions

View File

@ -1,9 +1,21 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
@Module({
imports: [],
imports: [
TypeOrmModule.forRoot({
type: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'jeremy',
database: 'nest',
synchronize: true,
entities: [__dirname + '/**/*.entity{.ts,.js}'],
}),
],
controllers: [AppController],
providers: [AppService],
})