I have a NX mono repo project where I want to use typeorm. The config file ormconfig.json is in the workspace root (same package.json folder) and this is the content:
{
"name": "default",
"type": "sqlite",
"database": "data/db.sql",
"logging": true,
"entities": ["libs/database/src/entities/*.entity.{ts,js}"],
"migrations": ["libs/database/src/migrations/*.{ts,js}"],
"cli": {
"entitiesDir": "libs/database/src/entities",
"migrationsDir": "libs/database/src/migrations",
"subscribersDir": "libs/database/src/subscribers"
}
}
As you can see the entities are in a database lib.
This configuration works fine for the migrations but when I try to call getConnection() (from anywhere, for example a node app inside the same workspace) I get the error ConnectionNotFoundError: Connection "default" was not found.