NestJS Crash Course
Vložit
- čas přidán 2. 06. 2024
- In this video we will explore the Nest JS Node.js framework which allows you to build fast and scalable server-side apps and APIs.
Sponsor: DevMountain Bootcamp
goo.gl/6q0dEa
Code:
github.com/bradtraversy/nestj...
💖 Become a Patron: Show support & get perks!
/ traversymedia
Nest JS Docs:
docs.nestjs.com
Website & Udemy Courses
www.traversymedia.com
Follow Traversy Media:
/ traversymedia
/ traversymedia
/ traversymedia - Věda a technologie
6:30 - generates controllers
11:51 - defines DTO (data transfer object)
16:34 - req, res from Express
19:37 - params
25:43 - services
37:52 - connect to mongo
ty
thanks
ty
@@amitkadosh8444😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊l😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊0
Brad even tho I wont look at this course right now I want to thank you for all you've done! There are few people who teach like you and even for for free!
You are gift from god keep that in mind :)
This
Kristian thanks friend 😊
Kristian, such a wonderful name.
Thank you!
One thing:
49:20 When you return promise from async function, you don't need to await for it. This will be done by design.
Whaaaaat. I looked into NestJS a couple days ago and was sad to see you didn't have a video on it AND here you are! You magician, you!
One thing to note (which doesn't matter since Nest resolves it) but once you included the "ItemsModule" into the application module, you can remove the ItemsController and ItemsService from the controllers and providers arrays since that module is bringing in those things. Great video Brad!!
I was getting some weird error about the Nest not being able to resolve some modules ... and doing as your input made it all go away
Oh, nice.
Thanks 1+ also fixed my error about modules not being resolved
I got an error 'Error: Nest can't resolve dependencies of the ItemsService (?). Please make sure that the argument ItemModel at index [0] is available in the AppModule context.' After following your procedure, it is resolved. Thank You!!
One of the best best tutorials ive seen. I am soo thankful for this video because I needed to learn NestJS really as quickly as possible for my work...youve explained each and every small detail soo clearly that it just sank in my mind immediately! Thank you SO MUCH. This definitely deserves a lot lot more views
Good timing...I've been fiddling with it the past week. Node needs more frameworks with tutorials and such. Structuring things is my main frustration and I've decided I like typescript
Thank you for this Brad. I was starting to learn the mean stack and was finding a good nodejs framework related to angular. I found nestjs but was a bit hesitant. After watching this, I will continue with nestjs. God bless 🙂
When I have to do an API in NestJS for a project, boom, new Brad's videos about that. Many thanks !
He always do this 😍 God bless him
Udemy best-seller NestJS course author here. Great content, Brad!
Just to correct one thing - you don't *need* to create a DTO. You can send/receive data in controller handlers without doing so. It is just a better practice that has plenty of other benefits.
Must have a look, can nest and next be a good combo, thanks!
Just typescript typed system
Thank you for all the great tutorials and courses! I now have the skills and ideas for my own CZcams tutorials from some things I've built
You have no idea how grateful I am for your tutorial, I have just finished building an API in Node and I have to replicate it in NestJS ... Guess I have landed on a perfect tutorial
Good video. Just finishing off an Angular course myself; and researching NodeJS also. Good tempo on how this set of code is put together in the video; easy to follow along. Thanks!
*UPDATE*: 1) make sure you remove the ItemsController and ItemsService imports from the app.module.ts file, otherwise it is causing an error
2) async create(item: CreateItemDto): Promise {
const newItem = new this.itemModel(item);
return await newItem.save();
}
should be the code in @Post method (here create)
you are the hero
thanks man it helped :)
Really good crash course Brad, the level of details was on point to still be captivating and covered all the important bits. Thank you!
Very clear and easy to follow and understand crash course. I wish you'd provide more such courses with advanced nest.js topics!
After watching your tutorial, I began looking at other NestJs videos. There's not a whole lot out there and each and everyone really blows big time. Yours is the only one that I can understand and learn from. You've got a knack for teaching. Thank you
There are good Udemy courses of you're willing to part with some coin.
Thanks!! if you are using the latest version, you need to extend Document in your Interface
import { Document } from 'mongoose'
export interface Item extends Document{
id?: string;
name: string;
description?: string;
qty: number;
}
Yep faced this problem too, did the same fix as well. Weird how the official guide in nestjs website doesnt show an updated version of this. Had me wondering for some time if I had messed up elsewhere.
a thousand thank yous
Thank you! This solved the error I was getting too.
Wow, what a framework.
You are the best, Brad!
duuude, you are my sensei in codefu. Excellent video, mad props.
Subbed, pretty straightforward, not even a single useless word, thanks for that
Brad your tutorials are master pieces learnt a lot. Thanks for the sessions and efforts you are putting. make people be happy🙃
When I get to some project where I need to use some other tech stack I'm not used to, my initial reflex is typically to open the doc, skim it, then skim the getting started.
Then I check if TraversyMedia has a crash course on it, to get a bit of context & useful tips. Then I do the Getting started of the project/docs, then I crush the project. Thanks.
Great video ever for Nest framework! Thanks Brad
Thanks a lot! Really helpful tutorial. So short and concentrated, that's what I've been searching for 🔥
OMG we r starting a new project with nestjs in the backend, thanks bro,
Thank you, Brad. Great as always. Wish there was a better/easier way to handle errors from new versions ( I ran into 2-3), but if you're resourceful enough, I was able to find all explanations in the comments... Anyway, thank you!
chat gpt suggest me this tutorial and i loved it keep it up Traversy Media that was best tutorial i have seen on Nestjs
when you're looking for a tutorial over and over and you can't find anything on the web, Brad comes to the rescue! Great
Looks great and awesome, I'm gonna master it.. Thanks to Traverse Media for your kindness!
Looks very similar to Java Spring. Awesome!
Great crash course as always Brad! Love from Germany
Thank you so much! Just started to learn NestJS and this is a huge help.
Please make a video on elastic search with nodejs and expressjs.
MUCH NEEDED VIDEO!!
(:
Really good crash course. Brad know how to explain everything very well! Thanks
Thanks for the great tutorial. Very full feature and loads of useful, practical info. Two thumbs waaaay up 👍👍
I really really enjoy these crawh course vids man, they saved my ass with js and css, i really hope you will do one for c# bc im kind of lost, anyways, really love your stuff keep up the good work!
Oncredibly good video. Coming from angular this was easy to catch up.
I loved it. I was just about to give it a try but I feel for it.
Invaluable and perfectly explained! Many thanks
Clean introduction course. Easily understandable.
Thanks Brad! Perfect explanation as always!
one of my favorite teachers , thank you brother
Hello brad ! Me and lots of people are probably waiting for a course that you will go into depth of nestjs on udemy. U re best !
Found your crash course very helpful, Thanks a lot man!!!
Thank you again and again. From your videos, I got hired :)
Thanks a lot, your tutorial is so clear and easy to follow.
neat, clean & fastest tutorial.
Thanks a lot
Thank you Brad! This was very good.
Hey Brad,
This is the Best NestJs Video I could find as per today. I am wondering if you have done any additional videos on NestJs for RBAC/Authentication.
Thanks, Brad for this crash course. :)
That's quite a tutorial Brad, thanks a lot.
Just a few side notes: I think you forgot to remove ItemController & ItemService declaration in AppModule, and async/await is not necessary in ItemService since mongoose return promises anyway.
I just realized the same, the ItemController and ItemService are into ItemModule, so I think that we don't need its all in the app.module, is it correct?
Brad, i thank you, , sir. You are a great teacher and expiration for me. This crash couse is really helpfull andwell structured. Full respect again !
Expiration ??
WOW just what I needed! Thanks so much!
Cool! Pretty clean and understandable! Nothing extra 👍
Thank you a lot!
Please make a more complete course for nest. This course doesn't contain some important concepts like middleware, authentication and etc. Thanks Brad ❤️
Just had an interview with a company where they mentioned they were starting to use Nest for some of their APIs. Can definitely see why. This is neat
nice fella
7th...Always in love with Brads tuts
I want to thank you for all you've done:)
You, sir, are amazing and a lifesaver!
Amazing 🤩 Nest is super coool for me, because I am very familiar with angular 🙌♥️
that was really great tutorial for basic concepts :)
Thanks Brad! NestJS is sweet!
Awesome tutorial Brad sir
Great tutorial, as always!
Hello Brad,
Thanks you posting video for nestjs.
Can you also make video for micrroservices using nodejs with mongodb.
I appreciate your support
Good contribution, Brad! Take care.
P/S: I'm from Viet Nam
It was just a awesome overview❤❤
Useful Crush Course! Thank you!
Great introduction!
Great as always! Thank you
You're a legend Brad!
Hello, Brad!
I love your videos so much and I have a nice idea which I think is especially relevant now.
Can you please create a crash course on the blockchain technology and than another video with applying blockchain practically by building a real election application. (where you can elect the president). I think it might be interesting.
Quick side note: the item module could also be generated with the CLI, which would import it to the app module automatically.
Hi Mr. Brad, in 27:58 I think "id" field defined on the item interface should be called "_id" since we are using mongodb to store our data
Nice! More of this please!
26:29 Rather make a "nest g module " first and then a "nest g service " so it autoimports.
hi, pls am have problems at 48:05 mongoose integration Type 'Item' does not satisfy the constraint 'Document. pls if anyone know where i made the mistak i need help
Looks amazing, wanna make a project now with nest, graphql, mongo, scss after I watched this :) for login what would you prefer? django?
this is the nest tutorial ever, you have the nest explanations ever
This is very beautiful article.
thank you brad ..
want more video in nestjs '☑️.
Hey Brad, how would you compare this to express?
Dev Ed More heavyweight. If you don’t like opinionated framework, this might be bad and bloated. However, Nest does support a lot out of the box so it’s up to you
Express : Nest == Flask : Django
@@vkexplores Yeah, Basically
Nest.js is a TypeScript framework but can be used with JavaScript if you want (nobody does and should). Express is a JavaScript framework; it can be used with TypeScript but it wasn't written with TypeScript in mind.
Nest.js is a layer on top of either Express (by default) or Fastify. If some other low-scope framework like these two gain popularity, Nest developers will probably write an adapter for using it.
Express is a low-scope, unopinionated framework. It is an assembly line for external middlewares; it's hardly callable a "framework", as 2 express projects can be radically different. In fact, the common expression "unopinionated framework" sounds to me a bit like an oxymoron to me: a framework needs to have opinions to be a "framework".
Being unopinionated, Express doesn't tell you how to structure your project and how your app should be developed, meaning that you are totally free to structure your project as you want; this can be seen as an advantage or a disadvantage, depending who you are and what you need. In Express, everything is basically a router, a middleware or a herror handler (another kind of middleware). Express is, for the most parts, an implementation of the "chain of responsibilities" pattern.
On the other hand, Nest.js is opioninated. It comes with a project structure and introduces you to the typical components of a well-designed application, like controllers, services, DTOs etc. In the documentation you find recipes for about every aspect of a web application. Think about this when you find yourself reading blog posts of doubtful quality on Medium on how you should structure your Express project.
If you write Express code for a real application as it's written in typical toy example tutorials you'll end up with a pile of disorganized and untestable spaghetti code where everything is inside controllers (routes); if you follow best practices, you'll end up with a project structured similarly to nest.js (or more commonly but less ideally, with files splitted by "component type" rather than by feature); this structure seems overkill in tutorials like this, of course, but it's what you want in the real world and it's what is suggested by Express experts (see for example github.com/goldbergyoni/nodebestpractices/blob/master/sections/projectstructre/breakintcomponents.md).
Express is older and more popular. Nonetheless, popularity as measured by the number of downloads doesn't necessarily reflect the real world usage by companies. On the web I see everyone talking about JS and Python. In the real world I see mostly Java and C# (for the backend). Anyway, I'm pretty sure Express is more used than Nest.js. Notice that Express will always have more downloads, given that Nest.js uses it under the hood.
@@gianluke you're great!
Thank you very much Brad!
thank you so much for this! clearly explained. PS: is anyone has an error with the ItemModel just delete the imports of ItemsService and Items Controller from app.module. Since we already get them by importing ItemsModule, they are not necessary.
Great tutorial as always!! What Vscode theme are you using? :)
Nicely done.. Only thing I would like to know, how to write the unit and e2e test cases for these end points.
Great great content, you should be create a complet guide of nestjs on Udemy or another teaching platform, it would be really great
@Traversy Media
#Traversy Media
I am using this framework and it is 2 drops of water as Angular front end framework. I love it very much as it uses #Typescript and DI. I think your audience is ready for a full project using the #Nest.js framework to actually be aware of its capabilities. Just like some of the commenters here said, it reminds #asp.net very much because they're both MVC framework. Another thing Nest.js is good at is seperation of concerns and scopes and it also supports #Fastify if you use it among other technologies. I suggest every one to check the official documentation
Thank u brad I'm learning from ur media. It's very useful for me thanks you so much.and I m preparing a star rating and login page using reactjs. But I want demo video for that pls upload its my request pls
Microservices + Nest would be another great tutorial.
yes
Thanks for the video, I'd know how to handling with Erros and Status Code in the response.
And the DTO has a check req.body validator inside, which automatically return an error if the body is different?
Hi Brad, where do you learn and hear about all the new technologies?
Oh good angular on server-side... That is great 🙄🙄🙄🙄🙄... Just joking great job Brad 🙏🙏
Can anyone tell me what's the advantage of using a service to wrap your Mongoose calls? I'm sure there is one but I can't think of one that's really compelling to me.
Nest is structured like Angular but Angular doesn't have an ORM layer so it makes sense to put HTTP calls in a service. Since we're using Mongoose I can't find the logic of basically calling an abstraction layer (Mongoose) from an abstraction layer (services).
Brad can you make full stack angular/nestjs course?
Thanks Brad! What is Visual Code Theme that you using? Looks cool
ItemsService throws an error when you install the Mongoose module without the @types/mongoose module. When you do install the type module. The createItemDto object cannot be assigned to the parameter of type Item anymore...Please fix thanks
Good one, really helpful
Nest js , this js that js I m just fed up of these JavaScript frameworks. But still thanks always.☺️☺️
Would you make a complete nestjs course?