The tutorial demonstrates building a CRUD user creation feature using NestJS and Prisma ORM. It covers setting up the Prisma service, hashing passwords with bcrypt for security, managing database connection errors, and refining API responses by selecting specific fields to return.
Length 14:05
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #nestjs #prisma #typescript #crud #backend #bcrypt #postgresql #api #programming #software development
0:00 Okay, so we're ready to actually go into our 0:02 user service and 0:04 start implementing our CRUD functionality for the user, 0:08 starting off with the first route we know we have to actually create the user, 0:12 and now we can actually utilize the Prisma client types that the library 0:16 has generated for us based off of the schema we know we have. 0:20 So the first step is going to be able to actually provide the database 0:24 connection as an injectable dependency to our user 0:28 service. 0:29 Now, in the schema Prisma file, we've already provided the Prisma client 0:33 library with the information on how to connect to our database, so 0:37 the actual connection to the database has been abstracted away from us and is all 0:41 configured using this common schema Prisma file. 0:45 So we need a way to actually expose this Prisma client JS 0:49 library with our connection and all of our types to our 0:53 NestJS application. To do this, I'm gonna go ahead and 0:56 generate a new module for our app. So let's go ahead and 1:01 nest generate module prisma. 1:06 So this is gonna go ahead and create a Prisma module, 1:09 and let's go also ahead 1:10 and create a service for Prisma. So this is gonna be the 1:14 common Prisma service that we can inject in our other services 1:18 to 1:18 actually use the database. 1:20 So now we can see we have the Prisma folder, and inside we have the Prisma 1:24 module that's providing the Prisma service. 1:28 This has also been added to our root app module here as an 1:31 import. However, we don't actually need this at the root, 1:35 so let's go 1:35 ahead and remove it, 1:39 since we're gonna be importing it in the modules we actually need it in. 1:44 So now let's go back to the Prisma service and start filling this out.
The rest of the transcript is for members.
Sign in