0:00 All right, so our first step in setting up our 0:02 database connection in the back 0:04 end will be to install the necessary dependencies. 0:07 So here, make sure we CD into apps backend, 0:10 and let's use 0:11 PNPM to install what we'll need to set up Drizzle ORM. 0:16 So the dependencies we'll need will be Drizzle ORM itself. 0:19 We'll also need Postgres, which is the Node Postgres driver to 0:23 actually establish the connection to our Postgres database. 0:27 And we'll go ahead and install these dependencies. 0:30 Additionally, I'm also gonna install 0:33 @nestjs/config, which is a package we're gonna use 0:37 to actually read in environment variables from a .env file at 0:41 the root of our project, which uses .env underneath the hood to 0:45 load in environment variables, so we don't have to hard code environment 0:49 variables, 0:50 and then we can read them in locally. 0:52 And eventually, when we deploy our application to 0:54 production, we can swap these 0:56 out. Finally, make sure we add as a development 0:58 dependency 1:00 @types/postgres to get the necessary types. 1:04 With this in place, we should have the dependencies we need. 1:07 So let's head back to our project. So our first step is to go 1:11 into our root app module for the back end, and here we need to 1:15 initialize our config module so that it can read in those environment 1:19 variables. In this case, we need the environment variable to read 1:22 in the 1:22 connection string to our database. 1:25 Before I do this, let's go ahead and remove our default app 1:29 controller files since we won't be actually using these. 1:33 So I'll delete the app controller, app service, and remove them 1:37 from the root app module here so we have a clean, empty state. 1:41 And now in the imports array, go ahead and add the config 1:45 module import from nestjs/config and call
The rest of the transcript is for members.
Sign in