📝Prisma
This service is used to connect to the database using Prisma.
Imports
Environment Variables
Do you create variables an .env
file.
name
description
DATABASE_URL
Url of the database.
DB_PORT
Port of the database.
DB_USERNAME
Username of the database.
DB_PASSWORD
Password of the database.
DB_DATABASE_NAME
Name of the database.
Check the example file.
.env
Method of Use
To use this module, you need to inject it into the desired service.
Injecting the module into our service.
Modifying our main.ts
main.ts
With dependencies
You will need to inject the following interfaces.
Interface
Service
AppHostService
Properties
Methods
Method
Scope
Description
onModuleInit
public
This method is used to connect to the database.
enableShutdownHooks
public
This method is used to close the connection to the database.
Last updated