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
  • Наука та технологія

КОМЕНТАРІ • 370

  • @duyhieu7820
    @duyhieu7820 5 років тому +131

    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

    • @timtim9o5
      @timtim9o5 4 роки тому

      ty

    • @armanmkrtchian488
      @armanmkrtchian488 4 роки тому

      thanks

    • @amitkadosh8444
      @amitkadosh8444 2 роки тому

      ty

    • @onyekaogbusuo3157
      @onyekaogbusuo3157 11 місяців тому

      ​@@amitkadosh8444😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊l😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊0

  • @kristian9561
    @kristian9561 5 років тому +173

    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 :)

  • @FancyCapitalist
    @FancyCapitalist 5 років тому +3

    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!

  • @AlekseyNew
    @AlekseyNew 2 роки тому +6

    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.

  • @voiceofvaishhhh
    @voiceofvaishhhh 2 роки тому +1

    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

  • @Juanmv05
    @Juanmv05 5 років тому +24

    When I have to do an API in NestJS for a project, boom, new Brad's videos about that. Many thanks !

    • @ikezedev
      @ikezedev 5 років тому +1

      He always do this 😍 God bless him

  • @wintereh4818
    @wintereh4818 5 років тому +1

    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

  • @skverskk
    @skverskk 5 років тому

    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

    • @gosnooky
      @gosnooky 2 роки тому

      There are good Udemy courses of you're willing to part with some coin.

  • @michael.penrod
    @michael.penrod 5 років тому +18

    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!!

    • @bonfirecodecamp7210
      @bonfirecodecamp7210 Рік тому +4

      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

    • @dan_le_brown
      @dan_le_brown Рік тому +1

      Oh, nice.

    • @DenzelHooke
      @DenzelHooke 11 місяців тому

      Thanks 1+ also fixed my error about modules not being resolved

    • @AlluAdarsh
      @AlluAdarsh 10 місяців тому +2

      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!!

  • @erikslorenz
    @erikslorenz 5 років тому +9

    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

  • @tea_hanks1230
    @tea_hanks1230 4 роки тому

    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

  • @KBog
    @KBog 2 роки тому

    Really good crash course Brad, the level of details was on point to still be captivating and covered all the important bits. Thank you!

  • @MarkEdwardTan
    @MarkEdwardTan 5 років тому

    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 🙂

  • @donotenter578
    @donotenter578 5 років тому

    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!

  • @belindabaumgartner4639
    @belindabaumgartner4639 5 років тому

    Very clear and easy to follow and understand crash course. I wish you'd provide more such courses with advanced nest.js topics!

  • @arielweinberger
    @arielweinberger 5 років тому +20

    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.

    • @lardosian
      @lardosian 3 роки тому

      Must have a look, can nest and next be a good combo, thanks!

    • @davidolufemi9247
      @davidolufemi9247 2 роки тому

      Just typescript typed system

  • @apurvatripathi7633
    @apurvatripathi7633 4 роки тому +11

    *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)

  • @user-me9uj2hz6p
    @user-me9uj2hz6p 5 років тому +2

    Wow, what a framework.
    You are the best, Brad!

  • @bainapallivinodkumar7672
    @bainapallivinodkumar7672 Рік тому +1

    Brad your tutorials are master pieces learnt a lot. Thanks for the sessions and efforts you are putting. make people be happy🙃

  • @daniellaerachannel
    @daniellaerachannel 5 років тому

    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

  • @maxwellwynter174
    @maxwellwynter174 5 років тому +4

    duuude, you are my sensei in codefu. Excellent video, mad props.

  • @dimon.digital
    @dimon.digital 2 роки тому

    Thanks a lot! Really helpful tutorial. So short and concentrated, that's what I've been searching for 🔥

  • @ahmedn232323
    @ahmedn232323 5 років тому +5

    OMG we r starting a new project with nestjs in the backend, thanks bro,

  • @aarondizele4884
    @aarondizele4884 5 років тому +4

    Great video ever for Nest framework! Thanks Brad

  • @pastorfred2543
    @pastorfred2543 5 років тому

    Looks great and awesome, I'm gonna master it.. Thanks to Traverse Media for your kindness!

  • @daflanofficial
    @daflanofficial 3 роки тому

    Subbed, pretty straightforward, not even a single useless word, thanks for that

  • @theaigallery7
    @theaigallery7 Рік тому

    chat gpt suggest me this tutorial and i loved it keep it up Traversy Media that was best tutorial i have seen on Nestjs

  • @michaelgela
    @michaelgela 2 роки тому

    Thank you so much! Just started to learn NestJS and this is a huge help.

  • @cubeermaui
    @cubeermaui 3 роки тому +1

    Great crash course as always Brad! Love from Germany

  • @rafaeljan5089
    @rafaeljan5089 2 роки тому

    Really good crash course. Brad know how to explain everything very well! Thanks

  • @overbyte
    @overbyte 3 роки тому

    Thanks for the great tutorial. Very full feature and loads of useful, practical info. Two thumbs waaaay up 👍👍

  • @miluna94
    @miluna94 5 років тому +4

    Looks very similar to Java Spring. Awesome!

  • @MrAndreaGero
    @MrAndreaGero 4 роки тому +19

    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;
    }

    • @johnson5824
      @johnson5824 4 роки тому

      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.

    • @joeholmes4711
      @joeholmes4711 3 роки тому

      a thousand thank yous

    • @sethlewandowski2684
      @sethlewandowski2684 3 роки тому

      Thank you! This solved the error I was getting too.

  • @codesterlalit
    @codesterlalit 5 років тому +2

    I loved it. I was just about to give it a try but I feel for it.

  • @sethlewandowski2684
    @sethlewandowski2684 3 роки тому

    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!

  • @logiconabstractions6596
    @logiconabstractions6596 Рік тому

    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.

  • @HIMANSHUSHARMA-eh5wv
    @HIMANSHUSHARMA-eh5wv 5 років тому +6

    Please make a video on elastic search with nodejs and expressjs.
    MUCH NEEDED VIDEO!!
    (:

  • @masterlup
    @masterlup 4 роки тому +1

    Oncredibly good video. Coming from angular this was easy to catch up.

  • @ImConfusedVoteForErdogan
    @ImConfusedVoteForErdogan 3 роки тому

    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 !

  • @lukaspechar
    @lukaspechar 5 років тому

    Invaluable and perfectly explained! Many thanks

  • @mithilpatel3720
    @mithilpatel3720 4 роки тому

    Found your crash course very helpful, Thanks a lot man!!!

  • @imanhajimostafazadeh8449
    @imanhajimostafazadeh8449 2 роки тому

    one of my favorite teachers , thank you brother

  • @Johny1
    @Johny1 5 років тому

    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!

  • @saeedet19
    @saeedet19 2 роки тому

    Thanks Brad! Perfect explanation as always!

  • @jerryliu862
    @jerryliu862 2 роки тому

    Thanks a lot, your tutorial is so clear and easy to follow.

  • @dimitartsvetkov9490
    @dimitartsvetkov9490 5 років тому

    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 !

  • @GenieMagicLabs
    @GenieMagicLabs 3 роки тому

    neat, clean & fastest tutorial.
    Thanks a lot

  • @brillyanto
    @brillyanto 3 роки тому

    Clean introduction course. Easily understandable.

  • @varaprasadpepakayala1740
    @varaprasadpepakayala1740 5 років тому

    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.

  • @romanromanenko9520
    @romanromanenko9520 3 роки тому

    Cool! Pretty clean and understandable! Nothing extra 👍
    Thank you a lot!

  • @AbhishekSaxenaEnggIT
    @AbhishekSaxenaEnggIT 5 років тому

    Thank you Brad! This was very good.

  • @harleylovitos7233
    @harleylovitos7233 2 роки тому

    Thank you again and again. From your videos, I got hired :)

  • @amanpreet-dev
    @amanpreet-dev 4 роки тому

    Thanks, Brad for this crash course. :)

  • @developedbyed
    @developedbyed 5 років тому +48

    Hey Brad, how would you compare this to express?

    • @tnchau1410
      @tnchau1410 5 років тому +7

      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

    • @vkexplores
      @vkexplores 3 роки тому +35

      Express : Nest == Flask : Django

    • @aetherwebdev3620
      @aetherwebdev3620 3 роки тому +3

      @@vkexplores Yeah, Basically

    • @gianluke
      @gianluke 3 роки тому +50

      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.

    • @rahiyansafin449
      @rahiyansafin449 3 роки тому +1

      @@gianluke you're great!

  • @AT-vm2jh
    @AT-vm2jh 2 роки тому

    WOW just what I needed! Thanks so much!

  • @sanjaynarang9518
    @sanjaynarang9518 4 роки тому +1

    Great introduction!

  • @silviupanait8861
    @silviupanait8861 4 роки тому

    You, sir, are amazing and a lifesaver!

  • @newrind
    @newrind 2 роки тому

    Thanks Brad! NestJS is sweet!

  • @imransarkar1750
    @imransarkar1750 2 роки тому

    It was just a awesome overview❤❤

  • @Developerorium
    @Developerorium 3 роки тому

    Amazing 🤩 Nest is super coool for me, because I am very familiar with angular 🙌♥️

  • @ThomasFaller
    @ThomasFaller 3 роки тому

    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

  • @rajeev1668
    @rajeev1668 5 років тому +1

    Hello Brad,
    Thanks you posting video for nestjs.
    Can you also make video for micrroservices using nodejs with mongodb.
    I appreciate your support

  • @collinsk8754
    @collinsk8754 Рік тому

    Great tutorial, as always!

  • @salah3xx
    @salah3xx 5 років тому +2

    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.

    • @makssie
      @makssie 5 років тому

      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?

  • @Naija-kz5bd
    @Naija-kz5bd Місяць тому

    Thanks Brad. You are a genius!

  • @ahmedbakkali7728
    @ahmedbakkali7728 5 років тому

    I want to thank you for all you've done:)

  • @omirosvasdaris7697
    @omirosvasdaris7697 3 роки тому

    Useful Crush Course! Thank you!

  • @skhubs
    @skhubs 5 років тому

    Awesome tutorial Brad sir

  • @romaghorjomeladze439
    @romaghorjomeladze439 4 роки тому

    that was really great tutorial for basic concepts :)

  • @JohnDoe-sz5jh
    @JohnDoe-sz5jh 3 роки тому

    Nice! More of this please!

  • @TheKamble
    @TheKamble 5 років тому

    7th...Always in love with Brads tuts

  • @TheMarkoni1985
    @TheMarkoni1985 5 років тому

    Great as always! Thank you

  • @majidghafoorzade9906
    @majidghafoorzade9906 Рік тому

    Please make a more complete course for nest. This course doesn't contain some important concepts like middleware, authentication and etc. Thanks Brad ❤️

  • @joga_bonito_aro
    @joga_bonito_aro 2 роки тому

    You're a legend Brad!

  • @AlanJames1987
    @AlanJames1987 5 років тому +1

    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).

  • @maduikechukwu6828
    @maduikechukwu6828 5 років тому +1

    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

  • @simosiren1758
    @simosiren1758 5 років тому

    Thank you very much Brad!

  • @dzsi1994
    @dzsi1994 5 років тому +2

    Great tutorial as always!! What Vscode theme are you using? :)

  • @user-vq6pe5px9k
    @user-vq6pe5px9k 5 років тому +1

    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.

  • @kirant9339
    @kirant9339 5 років тому

    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

  • @haroonafridi1802
    @haroonafridi1802 3 роки тому

    This is very beautiful article.

  • @HaiLuu-ed2rz
    @HaiLuu-ed2rz 5 років тому

    Good contribution, Brad! Take care.
    P/S: I'm from Viet Nam

  • @novailoveyou
    @novailoveyou 4 місяці тому

    Brad is the best

  • @raianerezende7816
    @raianerezende7816 Рік тому

    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.

  • @makssie
    @makssie 5 років тому

    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?

  • @bhavyaratra5461
    @bhavyaratra5461 2 роки тому

    This was amazing, tysm

  • @jagggy_snake
    @jagggy_snake 5 років тому

    Many thanks for this.

  • @estebanmarin002
    @estebanmarin002 4 роки тому

    Good one, really helpful

  • @amangoswami1369
    @amangoswami1369 2 роки тому

    thank you brad ..
    want more video in nestjs '☑️.

  • @Shakas420
    @Shakas420 4 роки тому +1

    Quick side note: the item module could also be generated with the CLI, which would import it to the app module automatically.

  • @ahmednabil4456
    @ahmednabil4456 5 років тому +1

    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

  • @evans8245
    @evans8245 4 роки тому

    this is the nest tutorial ever, you have the nest explanations ever

  • @sadrichamkhi317
    @sadrichamkhi317 3 роки тому

    Well explained thank you

  • @AlcoCZ
    @AlcoCZ 2 роки тому

    Great video.

  • @ceralguy85
    @ceralguy85 4 роки тому

    Great great content, you should be create a complet guide of nestjs on Udemy or another teaching platform, it would be really great

  • @HermesNautico
    @HermesNautico 4 роки тому +7

    26:29 Rather make a "nest g module " first and then a "nest g service " so it autoimports.

    • @princed.taylor4440
      @princed.taylor4440 3 роки тому

      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

  • @abdmmess8809
    @abdmmess8809 3 роки тому

    Thanks Men save my day

  • @HeRvAsH93
    @HeRvAsH93 5 років тому

    Man. You. Are. The. Best

  • @sirbalafort2620
    @sirbalafort2620 2 роки тому

    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?

  • @joelee5682
    @joelee5682 5 років тому

    How will you structure your folder with Angular & Nestjs ? They both using folder name "src" .