NestJS Crash Course
Вставка
- Опубліковано 5 сер 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 - Наука та технологія
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.
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!
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.
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
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
Thank you for all the great tutorials and courses! I now have the skills and ideas for my own UA-cam tutorials from some things I've built
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.
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!!
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
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
Really good crash course Brad, the level of details was on point to still be captivating and covered all the important bits. Thank you!
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 🙂
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!
Very clear and easy to follow and understand crash course. I wish you'd provide more such courses with advanced nest.js topics!
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
*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 :)
Wow, what a framework.
You are the best, Brad!
Brad your tutorials are master pieces learnt a lot. Thanks for the sessions and efforts you are putting. make people be happy🙃
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
duuude, you are my sensei in codefu. Excellent video, mad props.
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,
Great video ever for Nest framework! Thanks Brad
Looks great and awesome, I'm gonna master it.. Thanks to Traverse Media for your kindness!
Subbed, pretty straightforward, not even a single useless word, thanks for that
chat gpt suggest me this tutorial and i loved it keep it up Traversy Media that was best tutorial i have seen on Nestjs
Thank you so much! Just started to learn NestJS and this is a huge help.
Great crash course as always Brad! Love from Germany
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 👍👍
Looks very similar to Java Spring. Awesome!
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.
I loved it. I was just about to give it a try but I feel for it.
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!
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.
Please make a video on elastic search with nodejs and expressjs.
MUCH NEEDED VIDEO!!
(:
Oncredibly good video. Coming from angular this was easy to catch up.
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 !
Invaluable and perfectly explained! Many thanks
Found your crash course very helpful, Thanks a lot man!!!
one of my favorite teachers , thank you brother
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!
Thanks Brad! Perfect explanation as always!
Thanks a lot, your tutorial is so clear and easy to follow.
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 ??
neat, clean & fastest tutorial.
Thanks a lot
Clean introduction course. Easily understandable.
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.
Cool! Pretty clean and understandable! Nothing extra 👍
Thank you a lot!
Thank you Brad! This was very good.
Thank you again and again. From your videos, I got hired :)
Thanks, Brad for this crash course. :)
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!
WOW just what I needed! Thanks so much!
Great introduction!
You, sir, are amazing and a lifesaver!
Thanks Brad! NestJS is sweet!
It was just a awesome overview❤❤
Amazing 🤩 Nest is super coool for me, because I am very familiar with angular 🙌♥️
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
Hello Brad,
Thanks you posting video for nestjs.
Can you also make video for micrroservices using nodejs with mongodb.
I appreciate your support
Great tutorial, as always!
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?
Thanks Brad. You are a genius!
I want to thank you for all you've done:)
Useful Crush Course! Thank you!
Awesome tutorial Brad sir
that was really great tutorial for basic concepts :)
Nice! More of this please!
7th...Always in love with Brads tuts
Great as always! Thank you
Please make a more complete course for nest. This course doesn't contain some important concepts like middleware, authentication and etc. Thanks Brad ❤️
You're a legend 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).
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
Thank you very much Brad!
Great tutorial as always!! What Vscode theme are you using? :)
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.
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
This is very beautiful article.
Good contribution, Brad! Take care.
P/S: I'm from Viet Nam
Brad is the best
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.
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?
This was amazing, tysm
Many thanks for this.
Good one, really helpful
thank you brad ..
want more video in nestjs '☑️.
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
this is the nest tutorial ever, you have the nest explanations ever
Well explained thank you
Great video.
Great great content, you should be create a complet guide of nestjs on Udemy or another teaching platform, it would be really great
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
Thanks Men save my day
Man. You. Are. The. Best
I try to install the nest CLI globally, however when I run `nest --version` to verify, my zsh shell tells me "command not found" even after I open up a new terminal window. Any pointers?
How will you structure your folder with Angular & Nestjs ? They both using folder name "src" .