NestJS Crash Course

Sdílet
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

Komentáře • 369

  • @duyhieu7820
    @duyhieu7820 Před 4 lety +130

    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 Před 4 lety

      ty

    • @armanmkrtchian488
      @armanmkrtchian488 Před 3 lety

      thanks

    • @amitkadosh8444
      @amitkadosh8444 Před 2 lety

      ty

    • @onyekaogbusuo3157
      @onyekaogbusuo3157 Před 9 měsíci

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

  • @kristian9561
    @kristian9561 Před 5 lety +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 :)

  • @AlekseyNew
    @AlekseyNew Před 2 lety +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.

  • @FancyCapitalist
    @FancyCapitalist Před 5 lety +2

    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!

  • @michael.penrod
    @michael.penrod Před 5 lety +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 Před rokem +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 Před rokem +1

      Oh, nice.

    • @DenzelHooke
      @DenzelHooke Před 9 měsíci

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

    • @AlluAdarsh
      @AlluAdarsh Před 8 měsíci +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!!

  • @voiceofvaishhhh
    @voiceofvaishhhh Před 2 lety

    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

  • @erikslorenz
    @erikslorenz Před 5 lety +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

  • @MarkEdwardTan
    @MarkEdwardTan Před 5 lety

    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 🙂

  • @Juanmv05
    @Juanmv05 Před 5 lety +24

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

    • @ikezedev
      @ikezedev Před 5 lety +1

      He always do this 😍 God bless him

  • @arielweinberger
    @arielweinberger Před 4 lety +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 Před 3 lety

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

    • @davidolufemi9247
      @davidolufemi9247 Před 2 lety

      Just typescript typed system

  • @wintereh4818
    @wintereh4818 Před 5 lety +1

    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

  • @tea_hanks1230
    @tea_hanks1230 Před 3 lety

    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

  • @donotenter578
    @donotenter578 Před 5 lety

    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!

  • @apurvatripathi7633
    @apurvatripathi7633 Před 4 lety +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)

  • @KBog
    @KBog Před 2 lety

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

  • @belindabaumgartner4639

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

  • @skverskk
    @skverskk Před 5 lety

    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 Před 2 lety

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

  • @MrAndreaGero
    @MrAndreaGero Před 4 lety +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 Před 4 lety

      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 Před 3 lety

      a thousand thank yous

    • @sethlewandowski2684
      @sethlewandowski2684 Před 3 lety

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

  • @user-me9uj2hz6p
    @user-me9uj2hz6p Před 5 lety +2

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

  • @maxwellwynter174
    @maxwellwynter174 Před 5 lety +4

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

  • @daflanofficial
    @daflanofficial Před 3 lety

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

  • @bainapallivinodkumar7672

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

  • @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.

  • @aarondizele4884
    @aarondizele4884 Před 5 lety +4

    Great video ever for Nest framework! Thanks Brad

  • @dimon.digital
    @dimon.digital Před 2 lety

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

  • @ahmedn232323
    @ahmedn232323 Před 5 lety +5

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

  • @sethlewandowski2684
    @sethlewandowski2684 Před 3 lety

    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!

  • @silentcoder7
    @silentcoder7 Před rokem

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

  • @daniellaerachannel
    @daniellaerachannel Před 5 lety

    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

  • @pastorfred2543
    @pastorfred2543 Před 5 lety

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

  • @miluna94
    @miluna94 Před 5 lety +4

    Looks very similar to Java Spring. Awesome!

  • @cubeermaui
    @cubeermaui Před 3 lety +1

    Great crash course as always Brad! Love from Germany

  • @michaelgela
    @michaelgela Před 2 lety

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

  • @HIMANSHUSHARMA-eh5wv
    @HIMANSHUSHARMA-eh5wv Před 5 lety +6

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

  • @rafaeljan5089
    @rafaeljan5089 Před rokem

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

  • @overbyte
    @overbyte Před 2 lety

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

  • @Johny1
    @Johny1 Před 5 lety

    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!

  • @masterlup
    @masterlup Před 4 lety +1

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

  • @codesterlalit
    @codesterlalit Před 5 lety +2

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

  • @lukaspechar
    @lukaspechar Před 5 lety

    Invaluable and perfectly explained! Many thanks

  • @brillyanto
    @brillyanto Před 3 lety

    Clean introduction course. Easily understandable.

  • @saeedet19
    @saeedet19 Před 2 lety

    Thanks Brad! Perfect explanation as always!

  • @imanhajimostafazadeh8449

    one of my favorite teachers , thank you brother

  • @ImConfusedVoteForErdogan

    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 !

  • @mithilpatel3720
    @mithilpatel3720 Před 3 lety

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

  • @harleylovitos7233
    @harleylovitos7233 Před 2 lety

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

  • @jerryliu862
    @jerryliu862 Před rokem

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

  • @GenieMagicLabs
    @GenieMagicLabs Před 3 lety

    neat, clean & fastest tutorial.
    Thanks a lot

  • @AbhishekSaxenaEnggIT
    @AbhishekSaxenaEnggIT Před 5 lety

    Thank you Brad! This was very good.

  • @varaprasadpepakayala1740

    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.

  • @amanpreet-dev
    @amanpreet-dev Před 4 lety

    Thanks, Brad for this crash course. :)

  • @salah3xx
    @salah3xx Před 5 lety +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 Před 5 lety

      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?

  • @dimitartsvetkov9490
    @dimitartsvetkov9490 Před 5 lety

    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 !

  • @AT-vm2jh
    @AT-vm2jh Před 2 lety

    WOW just what I needed! Thanks so much!

  • @romanromanenko9520
    @romanromanenko9520 Před 3 lety

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

  • @majidghafoorzade9906
    @majidghafoorzade9906 Před 11 měsíci

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

  • @ThomasFaller
    @ThomasFaller Před 2 lety

    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

  • @TheKamble
    @TheKamble Před 5 lety

    7th...Always in love with Brads tuts

  • @ahmedbakkali7728
    @ahmedbakkali7728 Před 5 lety

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

  • @silviupanait8861
    @silviupanait8861 Před 4 lety

    You, sir, are amazing and a lifesaver!

  • @Developerorium
    @Developerorium Před 3 lety

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

  • @romaghorjomeladze439
    @romaghorjomeladze439 Před 4 lety

    that was really great tutorial for basic concepts :)

  • @newrind
    @newrind Před 2 lety

    Thanks Brad! NestJS is sweet!

  • @skhubs
    @skhubs Před 5 lety

    Awesome tutorial Brad sir

  • @collinsk8754
    @collinsk8754 Před rokem

    Great tutorial, as always!

  • @rajeev1668
    @rajeev1668 Před 5 lety +1

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

  • @HaiLuu-ed2rz
    @HaiLuu-ed2rz Před 5 lety

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

  • @imransarkar1750
    @imransarkar1750 Před 2 lety

    It was just a awesome overview❤❤

  • @omirosvasdaris7697
    @omirosvasdaris7697 Před 3 lety

    Useful Crush Course! Thank you!

  • @sanjaynarang9518
    @sanjaynarang9518 Před 4 lety +1

    Great introduction!

  • @TheMarkoni1985
    @TheMarkoni1985 Před 5 lety

    Great as always! Thank you

  • @satyayuga0
    @satyayuga0 Před 2 lety

    You're a legend Brad!

  • @user-vq6pe5px9k
    @user-vq6pe5px9k Před 5 lety +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.

  • @Shakas420
    @Shakas420 Před 4 lety +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 Před 5 lety +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

  • @JohnDoe-sz5jh
    @JohnDoe-sz5jh Před 3 lety

    Nice! More of this please!

  • @HermesNautico
    @HermesNautico Před 4 lety +7

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

    • @princed.taylor4440
      @princed.taylor4440 Před 3 lety

      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

  • @mr.chinaski2613
    @mr.chinaski2613 Před 4 lety

    Looks amazing, wanna make a project now with nest, graphql, mongo, scss after I watched this :) for login what would you prefer? django?

  • @evans8245
    @evans8245 Před 4 lety

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

  • @haroonafridi1802
    @haroonafridi1802 Před 3 lety

    This is very beautiful article.

  • @amangoswami1369
    @amangoswami1369 Před 2 lety

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

  • @developedbyed
    @developedbyed Před 5 lety +48

    Hey Brad, how would you compare this to express?

    • @tnchau1410
      @tnchau1410 Před 5 lety +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 Před 3 lety +35

      Express : Nest == Flask : Django

    • @aetherwebdev3620
      @aetherwebdev3620 Před 3 lety +3

      @@vkexplores Yeah, Basically

    • @gianluke
      @gianluke Před 3 lety +49

      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 Před 3 lety +1

      @@gianluke you're great!

  • @simosiren1758
    @simosiren1758 Před 5 lety

    Thank you very much Brad!

  • @raianerezende7816
    @raianerezende7816 Před rokem

    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.

  • @dzsi1994
    @dzsi1994 Před 5 lety +2

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

  • @nbaua3454
    @nbaua3454 Před 5 lety

    Nicely done.. Only thing I would like to know, how to write the unit and e2e test cases for these end points.

  • @ceralguy85
    @ceralguy85 Před 4 lety

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

  • @alxizr
    @alxizr Před 4 lety

    @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

  • @kirant9339
    @kirant9339 Před 5 lety

    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

  • @safiqlodi834
    @safiqlodi834 Před 2 lety +1

    Microservices + Nest would be another great tutorial.

  • @makssie
    @makssie Před 5 lety

    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?

  • @raj080288
    @raj080288 Před 5 lety

    Hi Brad, where do you learn and hear about all the new technologies?

  • @fabricioalmeidamedeiros941

    Oh good angular on server-side... That is great 🙄🙄🙄🙄🙄... Just joking great job Brad 🙏🙏

  • @AlanJames1987
    @AlanJames1987 Před 5 lety +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).

  • @VMzaVAS
    @VMzaVAS Před 5 lety +3

    Brad can you make full stack angular/nestjs course?

  • @samuelkavin
    @samuelkavin Před 4 lety

    Thanks Brad! What is Visual Code Theme that you using? Looks cool

  • @maduikechukwu6828
    @maduikechukwu6828 Před 4 lety +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

  • @estebanmarin002
    @estebanmarin002 Před 4 lety

    Good one, really helpful

  • @kunal9079
    @kunal9079 Před 5 lety +14

    Nest js , this js that js I m just fed up of these JavaScript frameworks. But still thanks always.☺️☺️

  • @user-fh4xo2pc2d
    @user-fh4xo2pc2d Před 5 lety +2

    Would you make a complete nestjs course?