The correct shared module for Nest.js - https://blog.entrostat.com/setting-up-a-database-module-in-nest-js/
✓ Published0🌍 Public
Aackuser
Last edited Sep 2, 2018
Created on Apr 11, 2019
This example shows how to structure a shared Nest.js module that integrates TypeORM with a database connection. The `SharedModule` imports `DatabaseModule` and uses `TypeOrmModule.forFeature` to register the `User` entity for a specific database connection, while also exporting `DatabaseModule` and `UserService` for reuse elsewhere. The code relies on Nest.js decorators like `@Module`, `@Injectable`, and the TypeORM API, with configuration accessed via `Config.get.databases.main.name`.
AI-generated description