I'm using TypeORM with the fallowing configuration file: ormconfig.json
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "root",
"password": "my-secret-pw",
"database": "mytestdb",
}
My Entities files are stored on the ./src/bar/entity directory. I always get the following error:
RepositoryNotFoundError: No repository for "myTable" was found. Looks like this entity is not registered in current "default" connection?
The Entity is found when I manually add the directory to the configuration file:
{
...
"entities": ["src/bar/entity/**/*.ts"]
}
My Entity is defined like:
@Entity('myTable')
export default class MyTable {
@PrimaryGeneratedColumn()
public id: number;
...
How can I allow the TypeORM to find those entities without setting manually in the configuration file for each directory?