Closed zhangbobell closed 6 years ago
Solve this issue from nestjs mysql exemple project from github
import { join } from 'path';
TypeOrmModule.forRoot({
type: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'root',
database: 'test',
entities: [join(__dirname, '**/**.entity{.ts,.js}')],
}
P.S. excuse me for this, but I had to write it here
Solve this issue from nestjs mysql exemple project from github
Expected behavior
import { join } from 'path'; TypeOrmModule.forRoot({ type: 'mysql', host: 'localhost', port: 3306, username: 'root', password: 'root', database: 'test', entities: [join(__dirname, '**/**.entity{.ts,.js}')], }
P.S. excuse me for this, but I had to write it here
its not workin if you have orm.config.ts in ./src/config/... or ./dist/config
Here is the demo code in techniques/database section :
the
entity
configuration should be:delete
../
for purpose when runnode dist/main.js
, it will look for entity files from the root directory, and will find *.entity.ts files located insrc
, then it will cause buid failed such aserror stack shows:
unexpected token import in xxx.entity.ts