0:00 Now in this lecture, we're finally ready to connect our NestJS 0:03 backend 0:04 to our new RDS database. Now, before we do this, there's gonna be a 0:08 few changes we make to prepare our application for this connection. 0:13 So firstly, the first thing I wanna do is update our 0:16 database module. 0:19 So right now in our database module, we're simply reading in a single 0:23 connection string for the database. 0:25 And so instead of using a connection string, we wanna use actual 0:29 variables for the host, port, database, user, and password 0:33 instead of forming it all into a connection string. 0:36 Now, the reason why we wanna do this is because we're also gonna set up 0:41 SSL connection to our RDS database. 0:44 So by default, all connections to the RDS database need 0:48 to be using TLS or SSL, 0:52 meaning the connection to the database is fully encrypted, which is very 0:56 secure, meaning no one else can read the traffic 0:59 that's happening between 1:00 our application and the database because it's fully encrypted end to end, 1:04 which is really what we want, and this is the default in RDS. 1:07 Now, in order to configure SSL, we need to not use a connection string 1:11 format. So let's go ahead and refactor this next. 1:15 So again, instead of having this single connection 1:18 string, 1:19 we're now gonna break this up into multiple properties. 1:22 So we'll have the first property for the host. 1:24 And again, we're still gonna use the config service 1:27 to pull it off of our 1:28 environment variable. But now we're going to use the 1:32 database host environment variable. 1:35 And then we'll repeat the same thing for the rest of the properties that we need. 1:38 Now for port, we're going to use parse int function, 1:41 which is going to 1:42 convert the string value that we read off of the config
The rest of the transcript is for members.
Sign in