Static
forCreate a dynamic module for the DatabaseModule with optional Prisma client options. This method is used to configure the PrismaService with custom options, if needed.
Optional
options: PrismaClientOptionsOptional configuration options for the Prisma client.
// Import the DatabaseModule and provide custom options for the Prisma client.
DatabaseModule.forRoot({
datasources: {
db: {
url: 'DATABASE_URL',
},
},
models: {
User: {
// Custom model configuration
},
},
});
Generated using TypeDoc
DatabaseModule is a global NestJS module that provides a Prisma service for working with the database. It can be imported in any module to access the PrismaService and interact with the database.
Remarks
This module is designed to be used globally to ensure that the same instance of PrismaService is shared across the entire application, providing a single connection to the database.