Skip to content

Commit 7311b95

Browse files
sample(): fix typeorm configuration (production start)
1 parent c70f42c commit 7311b95

4 files changed

Lines changed: 25 additions & 19 deletions

File tree

sample/05-sql-typeorm/ormconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import { Module } from '@nestjs/common';
22
import { TypeOrmModule } from '@nestjs/typeorm';
3+
import { join } from 'path';
34
import { PhotoModule } from './photo/photo.module';
45

56
@Module({
6-
imports: [TypeOrmModule.forRoot(), PhotoModule],
7+
imports: [
8+
TypeOrmModule.forRoot({
9+
type: 'mysql',
10+
host: 'localhost',
11+
port: 3306,
12+
username: 'root',
13+
password: 'root',
14+
database: 'test',
15+
entities: [join(__dirname, '**/**.entity{.ts,.js}')],
16+
synchronize: true,
17+
}),
18+
PhotoModule,
19+
],
720
})
821
export class ApplicationModule {}

sample/13-mongo-typeorm/ormconfig.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
import { Module } from '@nestjs/common';
22
import { TypeOrmModule } from '@nestjs/typeorm';
3+
import { join } from 'path';
34
import { PhotoModule } from './photo/photo.module';
45

56
@Module({
6-
imports: [TypeOrmModule.forRoot(), PhotoModule],
7+
imports: [
8+
TypeOrmModule.forRoot({
9+
type: 'mongodb',
10+
host: 'localhost',
11+
database: 'test',
12+
entities: [join(__dirname, '**/**.entity{.ts,.js}')],
13+
synchronize: true,
14+
}),
15+
PhotoModule,
16+
],
717
})
818
export class ApplicationModule {}

0 commit comments

Comments
 (0)