NestJS DTO Schemas, Validation & Pipes Tutorial

  Рет қаралды 12,064

Dave Gray

Dave Gray

Күн бұрын

Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
In this NestJS DTO schemas, validation & pipes tutorial, we will build data transfer object (DTO) schemas and learn how to validate incoming requests with NestJS pipes, class validators and error handling.
💖 Support me on Patreon ➜ / davegray
⭐ Become a full-stack web dev with Zero To Mastery Courses:
- The Complete Node.js Developer: bit.ly/CompleteNodeJS
- Advanced React: bit.ly/AdvReactDev
- Junior to Senior Dev Roadmap: bit.ly/WebDevRoadmap-JrtoSr
🚩 Subscribe ➜ bit.ly/3nGHmNn
📬 Course Updates ➜ courses.davegray.codes/
❓ Questions - Please post them to my Discord ➜ / discord
☕ Buy Me A Coffee ➜ www.buymeacoffee.com/davegray
👇 Follow Me On Social Media:
GitHub: github.com/gitdagray
Twitter: / yesdavidgray
LinkedIn: / davidagray
🔗 Source Code: github.com/gitdagray/nestjs-c...
🔗 Playlist for this NestJS Series: • NestJS Tutorials for B...
NestJS DTO Schemas, Validation & Pipes Tutorial - Series Part 4
(00:00) Intro
(00:05) Welcome
(00:27) Starter Code
(00:44) Start the Server
(01:12) Why We Need Request Validation
(02:06) NestJS Pipes
(05:36) Creating a DTO Schema
(07:48) Extending a DTO as a Partial Type
(11:40) Applying the DTOs
(14:56) Class Validators
(19:53) Applying ValidationPipe
(24:08) Built-in HTTP Exceptions
(28:51) Wrap-up
📚 Tutorial References:
🔗 NestJS Official Site: nestjs.com
🔗 Class Validators library: github.com/typestack/class-va...
Was this NestJS DTO schema validation tutorial for beginners helpful? If so, please share. Let me know your thoughts in the comments.
#nestjs #dto #validation

Пікірлер: 47
@rushingwp
@rushingwp 2 ай бұрын
It is difficult to me to believe that you provide these rich in quality tutorials for free. Cheers, Dave.
@kirillzlobin7135
@kirillzlobin7135 7 ай бұрын
So nicely explained without overcomplicating stuff
@paulthomas1052
@paulthomas1052 7 ай бұрын
Great series. I'm new to nestJS and have found these recent videos really useful. Thanks so much !
@moathdw910
@moathdw910 7 ай бұрын
The best series I am LOVING this series thank you for your efforts Dave! I love Nestjs it's my main framework now
@aaaajuuu8653
@aaaajuuu8653 7 ай бұрын
Hey Dave, thanks for the new Nest.js series. I actually just recently started learning Nest.js and its a big benefit for me having some actual examples from you. Thanks for that and i am looking forward to the next videos! :)
@JonBrookes
@JonBrookes 6 ай бұрын
If I didnt know what DTO was I certainly do now, thanks Dave, this is another brilliant video your explanations of setting up strong types makes the job a breezed
@overrevvv
@overrevvv 5 ай бұрын
Thank you for putting so much time and effort into this amazing playlist.
@surajjha5623
@surajjha5623 7 ай бұрын
I really loved this nest js series. Thanks a lot sir.
@abdulziz5253
@abdulziz5253 7 ай бұрын
I cant wait more for the next videos!
@krishnawaske9798
@krishnawaske9798 Ай бұрын
Woaahhhh!! Been using NestJs for few time now. But learnt something new today. Thankyou
@szczepanrydzewski8179
@szczepanrydzewski8179 7 ай бұрын
Great video as always!
@user-ql5bm1xc8h
@user-ql5bm1xc8h 7 ай бұрын
Great job! Thank you!
@TravinskiyVladislav
@TravinskiyVladislav 7 ай бұрын
Thank you, Dave
@konfcyus4865
@konfcyus4865 6 ай бұрын
Thanks for the series.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 6 ай бұрын
Thank you for the support!
@kirillzlobin7135
@kirillzlobin7135 7 ай бұрын
This is very helpful
@theybecameus
@theybecameus 7 ай бұрын
thanks david❤
@gururajmoger8649
@gururajmoger8649 7 ай бұрын
Please continue sir 🙏
@viniciusmassari5503
@viniciusmassari5503 7 ай бұрын
I'm really impressed how nestjs handles so much thing for us with a few lines of code.
@kirillzlobin7135
@kirillzlobin7135 6 ай бұрын
Who knows how often videos are released for this Nest JS playlist?) Waiting for the next one...
@DaveGrayTeachesCode
@DaveGrayTeachesCode 6 ай бұрын
Just released the next one 1 minute ago. The release schedule has been every week but I took one week off for Thanksgiving.
@girishgirijan9900
@girishgirijan9900 Ай бұрын
Thanks
@Peter-ck1qg
@Peter-ck1qg 7 ай бұрын
Nice tutorial. Can we get a tutorial on microservices with express and nest after this series?
@mikoajkaleta6856
@mikoajkaleta6856 7 ай бұрын
waiting for more episodes
@danielouattara3857
@danielouattara3857 5 ай бұрын
Hello Dave, Happy New Year! I wish you the best ! Thank you for your teaching. It's great to learn with you Maybe that this is not the right place to ask... I find that if I make a "patch request" with an empty json object OR a json object with anything else than what describe in the "UpdateUserDto" class then it works. I know that there is the "extends PartialType(CreateUserDto)" on UpdateUserDto, meaning optional. Here my question: is there a way to model UpdateUserDto by saying: optional Yes ! but only among "name", "email" , "role" ?
@codernerd7076
@codernerd7076 7 ай бұрын
Oh no last video at comment time, home we soon get the next part, would be interested in a Nest.js API with a Next.js frontend project as well!
@user-ih9wm5hu6f
@user-ih9wm5hu6f 6 ай бұрын
Can you explain me about hls in node js and front end i think this is so important
@BrechtGijbels
@BrechtGijbels 2 ай бұрын
Is there also a way to avoid the repetition of the roles in the method findAll within the file users.controller.ts? I was hoping it would be possible to use them from a DTO file, as they are defined there.
@podoprigoraisv
@podoprigoraisv 17 күн бұрын
Thank you for the great tutorial. Do I understand right we have separate *.dto files due to convention one class per file instead to have one file users.dto.ts with all related classes?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
Yes, this is the standard structure from the documentation.
@adrien437
@adrien437 7 ай бұрын
hi, are you going to make a tutorial about jwt authentication for nest?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 ай бұрын
Maybe a separate auth series for NestJS.
@mrbilchalan
@mrbilchalan 7 ай бұрын
I have learned access token and refresh token technique from your Mern tutorial. Now, I am concerned about csrf token. The access and refresh token are all about authentication and authorization. I heard, when you send any form to server, try to validate csrf token also. My question is, is it necessary to use csrf token to be validate after applying your access token and refresh token technique. If it is then how to send and receive and validate it. Please consider to discuss it. Thank you.
@grant_vine
@grant_vine 7 ай бұрын
CSRF is more relevant to Cross Site (I.e. separate domain/url) requests as a form of point in time trust validation between two remote parties, so more applicable to auth styles where you are redirected to an auth service that is separate from your app. Access to secure domain cookies wouldn’t work in that case - however, if your front end and your API are all served from the same domain (or domain suffix but that isn’t as secure on a cookie level) then CSRF isn’t really relevant as both that api and front end can actually read that cookie as they are on the same domain - hence no need for an out of band trust verification.
@user-kz1om8oo8i
@user-kz1om8oo8i 5 ай бұрын
can u share the name of icon extentions of your vs code??
@fikreteliyev2266
@fikreteliyev2266 7 ай бұрын
Hi Access token save in httponly cookie and refresh in redis This is possible?
@user-ld1de1mc4h
@user-ld1de1mc4h 7 ай бұрын
Hey Dave, whats going on with this course? It's been almost 2 weeks since last video. Are you planning to continue on the series?!?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 ай бұрын
Yes, new video tomorrow. To find out what's been going on, check out my community post on my channel.
@codernerd7076
@codernerd7076 7 ай бұрын
Would it not better to use Zod for validation?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 ай бұрын
You can use Zod, but NestJS has validation pipes built-in.
@thomaslefebvre5866
@thomaslefebvre5866 6 ай бұрын
isn't it better to use implements instead of extends ?
@artyomtaranenko2267
@artyomtaranenko2267 7 ай бұрын
Nestjs-zod looks better, smaller. What r u think about this?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 ай бұрын
I haven't looked at it although I know you can use Zod with NestJS.
@Shriramkrishnhari
@Shriramkrishnhari 7 ай бұрын
👍
@user-rd8qh4dp2i
@user-rd8qh4dp2i 7 ай бұрын
smone who wants to give assistsance ? stuck with media querys...
@artyomtaranenko2267
@artyomtaranenko2267 7 ай бұрын
We need drizzle-orm)
@asadmehboob1300
@asadmehboob1300 7 ай бұрын
Drizzle ORM
Nest.js REST API with Prisma ORM, Neon Postgres
39:28
Dave Gray
Рет қаралды 12 М.
You Never Heard of This Form Element!? 😱
0:53
Dave Gray
Рет қаралды 12 М.
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 33 МЛН
Children deceived dad #comedy
00:19
yuzvikii_family
Рет қаралды 5 МЛН
PINK STEERING STEERING CAR
00:31
Levsob
Рет қаралды 24 МЛН
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 62 МЛН
How to get data from an API with Javascript
1:00
Richard Oliver Bray
Рет қаралды 21 М.
NestJS Tutorial #15  | Pipes
5:57
Shameel Uddin
Рет қаралды 104
This is Why CSS is so Frustrating! 😭
0:51
Dave Gray
Рет қаралды 213 М.
Next.js with React Testing Library, Jest, TypeScript
25:04
Dave Gray
Рет қаралды 54 М.
Learn useMemo In 10 Minutes
10:42
Web Dev Simplified
Рет қаралды 466 М.
Git Tutorial for Absolute Beginners
36:21
Dave Gray
Рет қаралды 59 М.
Learn SOLID Principles with CLEAN CODE Examples
28:35
Amigoscode
Рет қаралды 262 М.
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 33 МЛН