'TypeORM - how to reuse entities across many projects?
I've had a few project which is using this same database and entities. How to reuse entities across all of this projects? I don't want to copy all *.entity.ts
files and then paste to all projects, I want to reuse in some way only one copy of this entities.
here is my typeormConfig:
async createTypeOrmOptions(): Promise<TypeOrmModuleOptions> {
return {
type: 'postgres',
url: this.dbURL(),
entities: [join(__dirname, 'entities/*.entity.{js,ts}')],
migrations: [join(__dirname, 'migrations/*.{js,ts}')],
subscribers: [],
migrationsTransactionMode: 'each',
migrationsRun: true,
synchronize: true,
keepConnectionAlive: true
};
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|