Node.js Crash Course Tutorial #4 - Requests & Responses

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ค. 2024
  • Hey gang, in this Node.js tutorial we'll take a look at how we can gather information from a user request & then send back a response to the browser.
    0:00 -- request object
    3:22 -- response object
    9:05 -- returning html pages
    12:59 -- basic routing
    18:41 -- status codes
    22:17 -- redirects
    🐱‍👤🐱‍👤 JOIN THE GANG -
    / @netninja
    ----------------------------------------
    🐱‍💻 🐱‍💻 My Udemy Courses:
    + Modern JavaScript - www.thenetninja.co.uk/udemy/m...
    + Vue JS & Firebase - www.thenetninja.co.uk/udemy/vu...
    + D3.js & Firebase - www.thenetninja.co.uk/udemy/d...
    🐱‍💻 🐱‍💻 Course Files:
    github.com/iamshaunjp/node-cr...
    🐱‍💻 🐱‍💻 Other Related Free Courses:
    + Modern JavaScript Tutorial - • Modern JavaScript Tuto...
    + HTML & CSS Crash Course - • HTML & CSS Crash Cours...
    🐱‍💻 🐱‍💻 Node.js links
    + Download here - nodejs.org/en/download/

ความคิดเห็น • 429

  • @rickfearn3663
    @rickfearn3663 2 ปีที่แล้ว +91

    The video is the perfect example of the educational expertise of the creator. Instead of starting with the 'best' way of coding the serving of webpages, the author codes a more primitive way that is from a learning perspective, much more intuitive. Hats off to this outstanding creator.

  • @farrukhatabekov595
    @farrukhatabekov595 3 ปีที่แล้ว +108

    Here is an interesting thought. I just went to Udemy looking for a complete Node js course and spent an hour reviewing a number of Complete, Perfect , Modent, Latest Node js courses. In the end, I wasted almost an hour of my time going throught courses that are outdated, not for intermediate developers and mostly, not on the latest version. Just wanted to let you guys know channels like these are not many.

    • @NetNinja
      @NetNinja  3 ปีที่แล้ว +25

      Thank you :). Really appreciate it. Unfortunately tech moves on very quickly so things can become outdated easily!

    • @funworld8379
      @funworld8379 2 ปีที่แล้ว +3

      same thing happened me yesterday. searched on hour for node js course on udemy but couldnt find any good one. and then i stumbled upon this channel and i am following this tutorial.

    • @farrukhatabekov595
      @farrukhatabekov595 2 ปีที่แล้ว +5

      @@funworld8379 This is one of the best web development channels on TH-cam.
      I like how clearly Sean explains the topic in a quite short amount of time .

    • @funworld8379
      @funworld8379 2 ปีที่แล้ว +1

      @@farrukhatabekov595 exactly the explanation is clear and to the point

    • @someone11233
      @someone11233 2 ปีที่แล้ว

      @@funworld8379 Jonas's Course on Udemy "Node Js Express Js and mongodb - the Complete Bootcamp " Is best course ever made on Node Js .......

  • @sivach8667
    @sivach8667 3 ปีที่แล้ว +80

    The first channel I came across that explained Node js in a structured fashion. Every little detail is explained sooooo well. Thank you.

    • @adelprog
      @adelprog ปีที่แล้ว +2

      not just Node JS, i learned react from here. so thinks Shaun Pelling

  • @Ziad-Al
    @Ziad-Al ปีที่แล้ว +24

    This is what I love about Shaun's tutorials; he slowly takes you through the concept, explains what is going under the hood, and shows you how the code evolved and where it started. so you understand how to write the correct code block and why you are writing it that way.

    • @NetNinja
      @NetNinja  ปีที่แล้ว +3

      Thanks for the kind words Ziad - that's the aim! :)

    • @Ziad-Al
      @Ziad-Al ปีที่แล้ว +4

      ​@@NetNinja You are nailing it Shaun, Thanks a ton. you are helping thousands of people and that is awesome, I wish I can do the same for you, I bought your course, but I can do more, so if you need any kind of help to handle any extra tasks, just let me know. I will do it with pleasure and gratitude.

  • @ubarjaktarev
    @ubarjaktarev ปีที่แล้ว +37

    I can safely say that so far this has been the best Node resource I've come across, specifically because it doesn't jump into Express from the get-go. My first encounter with Node was basically mindlessly copying requires and module.exports and having no idea why which made it impossible to remember everything. This now actually makes complete sense. Thanks for this 👏👏

    • @NetNinja
      @NetNinja  ปีที่แล้ว +7

      Thank you for the kind words Uroš, really glad it was helpful :)

  • @AngaarUriakhil
    @AngaarUriakhil 2 ปีที่แล้ว +41

    I can't believe how good this course is, and free too! We live in a golden age of education. Thanks so much.

    • @tech3425
      @tech3425 ปีที่แล้ว +2

      Delightful outlook

  • @ourcode9330
    @ourcode9330 2 ปีที่แล้ว +2

    Honestly, I spent 5 months just by looking tutorials of many youtubers on Node JS course. But after 5 months of struggling, I cam here. Now I can assure that I am full satck JS Developer beacuse of you

  • @eazy2195
    @eazy2195 วันที่ผ่านมา

    I've been working as a frontend web dev for 3+ years now and started getting into backend, this is the first course that was easy to comprehend and that's coming from someone that already has coding experience, can't imagine a beginner looking at some of the other courses out there, how confused they might get

  • @prasathj7436
    @prasathj7436 ปีที่แล้ว +12

    This is incredible for anyone to learn progressively. Thanks a lot for taking time to put this together.

  • @oleggold
    @oleggold 2 ปีที่แล้ว +3

    Amazing tutorials Sean. I followed 3-4 months ago your JS tutorials, and it helped me a lot. Now, after watching some other tutorials here and there, decided 4 days ago to go back to your channel to look for these, and surprise surprise, a new tutorial just on the topic I need.
    Thank you so much!
    You are amazing!
    Cheers from Israel.

  • @Slikon
    @Slikon 3 ปีที่แล้ว +72

    So far the best Node.js tutorial for beginners I have ever found!
    Will this tutorial cover all those topics you explained in your previous Node.js tutorial 4 years ago?

    • @NetNinja
      @NetNinja  3 ปีที่แล้ว +26

      Hey, thanks. And yeah - I'll be covering pretty much everything the old one covers + a bit more.

    • @Slikon
      @Slikon 3 ปีที่แล้ว +6

      @@NetNinja Thank you so much! Looking forward to see your new videos!
      Thank you for what you do!

  • @msvague1292
    @msvague1292 3 ปีที่แล้ว +7

    Thank you so much for doing this tutorial. Understanding how all of this stuff works is how I learn. You are awesome! I've learned more about Node with the first 4 videos then I did at an actual coding bootcamp.

  • @muhammadahmedjaved7691
    @muhammadahmedjaved7691 3 ปีที่แล้ว +74

    I love your hardwork
    Keep it up and keep educating people

    • @NetNinja
      @NetNinja  3 ปีที่แล้ว +14

      Thank you so much 😀

  • @germain1984
    @germain1984 3 ปีที่แล้ว +2

    Love how you explain concepts, such great content

  • @jer254
    @jer254 3 ปีที่แล้ว +2

    I have done a node course that took me almost a month I mean yeah it helps when im coming here to look for more information but I cant believe how good Shaun is a great teacher. Like really this guys is the real deal and I know I can always count on Shaun. Stays away from the tech guru limelight but his work definitely speaks for itself. I freaking love you Shaun

  • @kerendn
    @kerendn 3 ปีที่แล้ว

    I love your teaching style. You start from the basic building blocks before explaining the more streamlined methods, so we can get a feeling for the code as we go and end up with a better grasp of it. Thank you for sharing your knowledge and skill as a teacher!

  • @JulesCalella
    @JulesCalella 3 ปีที่แล้ว +1

    Thank you for this video (and all of them really, I'm binge watching them). Most people jump straight into express, as you mentioned, and it makes it hard to see what Node is capable of on its own.

  • @mark3141592654
    @mark3141592654 2 ปีที่แล้ว +2

    Thanks for your time put on this, man. Amazing patience and dedication! Cheers!

  • @anishsaha397
    @anishsaha397 3 ปีที่แล้ว

    Your videos are the best. The way you explain things nobody else does. Thank you very much.😊

  • @lennythach607
    @lennythach607 2 ปีที่แล้ว +2

    Omg, This is so good! Exactly what I was looking for. You are very thorough with your explanation about req and res, unlike many others tutorials that brush through it quickly. I love that! Subscribed and Liked!

  • @utsavojha2953
    @utsavojha2953 3 ปีที่แล้ว

    Net Ninja youre amazing, only someone with a solid understanding could explain things so well!!!

  • @thomasm1964
    @thomasm1964 ปีที่แล้ว

    Yay! I now understand Node! It's taken weeks to get my head around half-understood concepts which you have so clearly explained in just over two hours! Next!

  • @PraveenKumar-ri9ee
    @PraveenKumar-ri9ee 3 ปีที่แล้ว +1

    This is the best tutorial on node js I found on the internet ... Thanks a lot sir!

  • @tekliebelay4896
    @tekliebelay4896 3 ปีที่แล้ว +2

    One of the best contents I have ever seen. Keep up the good work!

  • @evilprince2009
    @evilprince2009 3 ปีที่แล้ว

    This lecture was an eye opener. Can't thank you enough man! You are awesome.

  • @julianstorm7722
    @julianstorm7722 3 ปีที่แล้ว +1

    Absolute gem!! Thanks heaps for all your effort.

  • @danielwatson6529
    @danielwatson6529 2 ปีที่แล้ว

    This is such a good playlist!! ive come back around, as I kept up but I didn't absorb it all first time, but now its really sinking in

  • @murat6018
    @murat6018 2 ปีที่แล้ว +1

    Shaun is a legend. He really knows his stuff with all its underlying principles.

  • @abdullanilam8049
    @abdullanilam8049 11 หลายเดือนก่อน

    200% recommended this video tutorial. Really helps. No words to say

  • @timobrien4190
    @timobrien4190 2 ปีที่แล้ว +3

    I am a tutor and this helped my student and I on her assignment regarding setting up a server and answered a lot of questions we had, thanks!

  • @ZsoltGaramszegi
    @ZsoltGaramszegi 2 ปีที่แล้ว +1

    This is really useful, I can follow, I can practice, without wasting the time. Thank you so much and congrats!

  • @adventechoo
    @adventechoo 3 ปีที่แล้ว

    thanks man...loving this nodejs series

  • @AhmedAli-go7wx
    @AhmedAli-go7wx 3 ปีที่แล้ว

    So far the best Node.js tutorial for beginners I have ever found! thanks

  • @web_dev_host
    @web_dev_host 2 ปีที่แล้ว

    You are the best. I thought node js was something hard to grasp but you made it so easy to understand. Loved it.

  • @rhodesjh
    @rhodesjh 2 ปีที่แล้ว

    excellent course. Thank you. Glad I found this.

  • @elweonweandolaweafome
    @elweonweandolaweafome ปีที่แล้ว +1

    this crash course it's so incredible

  • @mvpmc69
    @mvpmc69 2 ปีที่แล้ว

    Very nicely structured tutorials.
    After looking through many, this one is the easiest to use.

  • @kresnofatihimani8402
    @kresnofatihimani8402 3 ปีที่แล้ว +1

    I was actually surprised to know we could actually do all this from scratch. I tried learning a Python Framework called Django and felt that the logic behind it didn't flow naturally. Good thing I found your videos. thx

  • @ozzyfromspace
    @ozzyfromspace 3 ปีที่แล้ว +1

    Before seeing your solution using switch statements, I tried writing the logic using if statements, and it sorta worked, but it was confusing to read and really buggy because I had fs.readFile() and fs.stat().isFile() methods flying around everywhere. Your method was eye opening. I think sometimes, the more advanced you are, the more streamlined your code can become, because I'm looking at what you did (from the pov of a noob) and just feeling awe for your coding design patterns. Thanks for making this series, sensei, you've really helped me! Prior to your series, I was feeling very disgruntled about the prospect of figuring out how to do server stuff (I tried some courses on php that were too cookie cutter for me to learn anything substancial) and seeing the flexibility of the node.js coding environment really opened my eyes to everything that's possible. You're a hero, mate! Greetings and blessings from the US 🙏🏽🎊❤️🔥🏆☮️🙌🏽

  • @Daniyal-ep4cj
    @Daniyal-ep4cj 2 ปีที่แล้ว

    simple and beautiful way of explanation

  • @eufraniodiogo50
    @eufraniodiogo50 3 ปีที่แล้ว

    I was watching a course here at youtube that was teaching nodejs, but dude, it was like, I was not learning nodejs I was learning frameworks yeah it's cool to learn frameworks it make our lives easier but we also need to understand what's happening under the hood and it's what you're teaching us!
    Thank you so much sir!

  • @AyushiSharmaDSA
    @AyushiSharmaDSA 3 ปีที่แล้ว +2

    Waiting for the next lesson..Thanks for making these tutorials :)

  • @whoIsV
    @whoIsV ปีที่แล้ว

    This node course is very easy to follow and nicely paced. Thank you.

  • @hajerakhatunsaba4694
    @hajerakhatunsaba4694 3 ปีที่แล้ว

    LOVE how you explain!!

  • @bujarismaili
    @bujarismaili 2 ปีที่แล้ว

    One of the best tutorials there - keep up with the good work!

  • @sathvikmalgikar2842
    @sathvikmalgikar2842 ปีที่แล้ว +4

    really admire the consistency and the homogenous format maintained across all the tutorials.
    very beginner friendly and easy to grasp

    • @NetNinja
      @NetNinja  ปีที่แล้ว +1

      Great to hear! Thanks for the kind words Sathvik :)

  • @settnaing199
    @settnaing199 3 ปีที่แล้ว

    The Best Node.js course for beginner like myself. Thank you!!!

  • @harishhasti8251
    @harishhasti8251 3 ปีที่แล้ว +2

    Sir, this playlist is helping me a lot, Thanks a lot for doing this playlist

  • @matthew78uk
    @matthew78uk 3 ปีที่แล้ว

    Best video EVER on plain node!

  • @higherpurpose1212
    @higherpurpose1212 2 ปีที่แล้ว +2

    Shaun's way of teaching really really suits me, clear complete explanations unlike the other ones I've seen from LinkedIn Learning where their instructors are assuming that small details are not that important, not switching between code files while explaining what their doing.
    Shaun, I hope you will consider making a full-pledge real-world website using MERN stack, maybe an e-commerce site for beginner to mid-level devs, if you submit it in Udemy I'll definitely buy it? :)
    Thanks for you great work. Keep it coming!

  • @prakhardhama3069
    @prakhardhama3069 2 ปีที่แล้ว

    This is the best video I have ever seen on TH-cam.

  • @EVA_Hamza
    @EVA_Hamza 3 ปีที่แล้ว

    Thank you so much, this is exactly what I need!

  • @hamzayousfi4275
    @hamzayousfi4275 3 ปีที่แล้ว

    Thank you for everything, too much value in all videos of this channel that's just WOW ... Good luck for the rest !!

  • @deanandreakis5010
    @deanandreakis5010 3 ปีที่แล้ว

    Really great tutorials...much appreciated!

  • @hadijafari5631
    @hadijafari5631 ปีที่แล้ว

    Thanks Shaun, You are a real Ninja.

  • @sadam_khan
    @sadam_khan ปีที่แล้ว

    OMG, Absolutely brilliant.

  • @Salehalanazi-7
    @Salehalanazi-7 3 ปีที่แล้ว

    Learned PHP many years ago, Never used it much and pretty much gave up on backend, Now I'm speed running thorough this course and it's amazing. Dude I know words aren't enough. Let me get paid.. Holy shit you're amazing.

  • @elendil4543
    @elendil4543 3 ปีที่แล้ว +1

    10:29 best require pronunciation ever

  • @akshittrikha2297
    @akshittrikha2297 3 ปีที่แล้ว

    Dude, you are the best ninja ever!

  • @ozzyfromspace
    @ozzyfromspace 3 ปีที่แล้ว +1

    Lol when the ads come on, I usually let them play ❤️ I'm a broke, unemployed bum rn lol, so this is the only way I know to support. And I've shared your channel with some coder friends of mine. You absolutely rock, and one day I hope I'm in the position to support your work substantially! The internet owes you a massive debt, my guy! 🔥🙌🏽

  • @SeeKnowledge
    @SeeKnowledge 3 ปีที่แล้ว

    thanks for sharing your knowledge for free of cost

  • @ibrahims5457
    @ibrahims5457 3 ปีที่แล้ว +1

    You're doing great man...

  • @garryborn195
    @garryborn195 ปีที่แล้ว

    Well done!
    Thanks!

  • @marvin_e
    @marvin_e 3 ปีที่แล้ว +2

    The way you teach🙌🏼🙌🏼 Just Amazing 🙌🏼🙌🏼

    • @NetNinja
      @NetNinja  3 ปีที่แล้ว +1

      Thank you so much 😀

  • @farahmalallah
    @farahmalallah 3 ปีที่แล้ว

    Amazing as always .. Thank you!

  • @senyam8931
    @senyam8931 2 ปีที่แล้ว

    u r great believe me , u explain everything by the easiest way , thanks a lot

  • @ThatBritishVlogger
    @ThatBritishVlogger 3 ปีที่แล้ว +14

    Your content is acutely aware of our short attention spans! It is appreciated. Havn't decided whether I prefer lots of small videos or larger ones broken up to specific lectures, but breaking it up one way or another is definitely a good thing!
    Update: Decided I prefer more shorter videos, it will allow me to quickly reference the material I need when I am using this stuff in my own projects.

  • @naywinhlaing7574
    @naywinhlaing7574 3 ปีที่แล้ว +50

    you are the best ever!

  • @MuhammadAhmad-bx2rw
    @MuhammadAhmad-bx2rw 2 ปีที่แล้ว +1

    Perfect Teaching

  • @amalsunil4722
    @amalsunil4722 ปีที่แล้ว +2

    At 24:53 it's better to use 'return;' instead of 'break;' in line number 24 so that we exit the function.
    Otherwise it could lead to error as we're then trying to read from a file './views/' which is not valid.
    Thank you so much for the wonderful tutorial my friend.
    Cheers!

    • @dannykryan
      @dannykryan ปีที่แล้ว

      thanks for this comment, for me, I'm getting my redirect back with an added '/' (/about/) which doesn't exist. So, neither 'break' or 'return' are working for me. Do you have any idea why?

  • @aliahmedkhan9690
    @aliahmedkhan9690 ปีที่แล้ว

    If I'd get to live with one person on this earth, just one person for my entire life, I would go on living with you! Thanks Man for adding so much value to our lives.

  • @chemedev
    @chemedev 3 ปีที่แล้ว +4

    If the redirect doesn't work try disabling cache in network tab, if not it will try to read it from disk...

    • @murodu
      @murodu 3 ปีที่แล้ว +1

      Thanks for the tip. I was stuck for about good 10 minutes trying many things (if, else,,, rewriting...). Sometimes simple trick like this works. But it is best part of learning coding and get the feeling of finally being able to figure out stuff🧐

    • @betofc89
      @betofc89 ปีที่แล้ว

      How to clear this cache in the code? I mean, if I want to redirect to another page, other than about.html, I'm struggling to do that, because the redirect from "about-me" to "about" is already set and cached. if, for example, I try to redirect "about-me" to, let's say, "404.html", it is still redirecting to "about", because it's kind of cached. How to clear this? Thanks in advance!

  • @dpxy1599
    @dpxy1599 6 หลายเดือนก่อน

    Playlist so good I am binge watching it

  • @ozzyfromspace
    @ozzyfromspace 3 ปีที่แล้ว +16

    Net Ninja: "I think your website will have more than two lines of code"
    Me: "That's a bold assumption" 😂

    • @oleggold
      @oleggold 2 ปีที่แล้ว

      NOIIICCCEEE :) hahaha

  • @timohaverich2422
    @timohaverich2422 2 ปีที่แล้ว

    Amazing work!

  • @liaesttonami
    @liaesttonami 2 ปีที่แล้ว

    Very interesting chapter!
    Basic routing system, status code, redirection... We control all these stuff and it's enjoyable, thanks to your course :)

  • @anudeepananth
    @anudeepananth 3 ปีที่แล้ว

    You are a knowledge GURU!

  • @samjimmy8783
    @samjimmy8783 3 ปีที่แล้ว

    best node js tutorial for beginner, thanks for sharing knowledge

  • @benjaminnwokolo2935
    @benjaminnwokolo2935 2 ปีที่แล้ว

    Best tutorial man🔥🔥🔥

  • @msaters8166
    @msaters8166 2 ปีที่แล้ว

    Love your content, your videos help a lot!

  • @Bruno87198
    @Bruno87198 ปีที่แล้ว

    Anybody can learn from your crash courses! Everything is so clear and very understandable. You speak in a clear way, your English is easy to understand and the way you cover the basics so we can learn better in the next steps, is just AWESOME! Thanks a lot for all theses videos and crash courses. Cheers from Brazil.

    • @NetNinja
      @NetNinja  ปีที่แล้ว +1

      Thanks for the kind words Bruno :) big love to Brazil!

  • @zsaing1
    @zsaing1 3 ปีที่แล้ว +1

    I have checked few course (by well known people) so far on the same topic. But, your course is by far the best. You have got very good skills to communicate the concepts beside giving the code demonstrations. Really appreiciate and thank you very much for this wonderful work that is available free to all. Thumns up

    • @NetNinja
      @NetNinja  3 ปีที่แล้ว

      Thanks so much 😃

  • @prabhatsingh2606
    @prabhatsingh2606 3 ปีที่แล้ว

    This is amazing man keep going

  • @dev.regotube
    @dev.regotube 3 ปีที่แล้ว

    Thanks. Again for making this video!

  • @Stevenalp18
    @Stevenalp18 6 หลายเดือนก่อน

    Love your videos man! I am doing a 30 day coding challenge and staying committed by posting daily and dude you have been teaching me what a instructor could not, your the instructor I wish I had before. Thanks again man! Will definitely support the channel

    • @NetNinja
      @NetNinja  6 หลายเดือนก่อน

      Thanks Steven, this is great to hear :) good luck with your challenge!

  • @mattcaffery133
    @mattcaffery133 3 ปีที่แล้ว

    Love you Shaun. Thank you for your efforts brother :)

  • @issaissifou4959
    @issaissifou4959 2 ปีที่แล้ว +1

    Thank you so much!

  • @kostiantynkarzhanov9216
    @kostiantynkarzhanov9216 7 หลายเดือนก่อน

    Very well structured and simply to understand! Thank you so much for your work! Great tutorial 💛

  • @MrKaremnour
    @MrKaremnour 3 ปีที่แล้ว

    I just watch Ur video because Ur awesome accent and easy learning...u r rock

  • @pawels8040
    @pawels8040 3 ปีที่แล้ว

    Hey man , thanks for new content. 👍🏻

  • @ZyncInteractive
    @ZyncInteractive 3 ปีที่แล้ว +1

    Love your work mate. Keep up the great work! Subbed and joined

    • @NetNinja
      @NetNinja  3 ปีที่แล้ว

      Thank you so much :).

  • @olanrewajuademola3573
    @olanrewajuademola3573 ปีที่แล้ว +3

    if anyone is having issue with this:
    case '/about-me':
    res.statusCode = 301;
    res.setHeader('Location', '/about');
    res.end();
    break;
    You might have to clear cookies or try another browser.

  • @yinonb172
    @yinonb172 3 ปีที่แล้ว

    best node.js tutorial ever

  • @keduslejiyared8701
    @keduslejiyared8701 3 ปีที่แล้ว

    Thank you so much sensei.

  • @ahamster3000
    @ahamster3000 ปีที่แล้ว

    From Morocco with love , thank you sir for this simplicity .

    • @NetNinja
      @NetNinja  ปีที่แล้ว

      You are very welcome! Hi to Morocco (great World Cup!) :)

  • @workhard7922
    @workhard7922 3 ปีที่แล้ว +1

    thank you very much, i hope to do an application sharing screen and video call using node js and web rtc

  • @kerou4276
    @kerou4276 ปีที่แล้ว

    thank you for all this information .

  • @fallofmanbrand
    @fallofmanbrand 3 ปีที่แล้ว

    Loved It!

  • @benardben9573
    @benardben9573 10 หลายเดือนก่อน

    excellent delivery

  • @julianvazquez1435
    @julianvazquez1435 3 ปีที่แล้ว

    Dude you're amazing.