Database connection
First, we should connect to the database.
Let's create a DatabaseModule
to connect to the database.
In its imports
array, add the following
The autoLoadEntities
option automates the loading of domain's entities.
Commit - Connecting to database
Alright, we established a connection to the database. But this solution is not very interesting, don't you think? We are exposing all our credentials here. The same problem appeared again.
In the Configuration section, we'll learn how to fix this issue through the usage of environment variables and also have validation/typing for them.
Last updated