Node.js Crash Course Tutorial #1 – Introduction & Setup
Video Title: Node.js Crash Course Tutorial #1 – Introduction & Setup
Hey gang and welcome to your very first step in becoming a node ninja a rather than gang now I do already have a node tutorial on this channel but I wanted to update it because now that’s about four or five years old so I wanted to do a
Quick refresh a nice new node tutorial because in the future I’m going to create some more advanced node tutorials as well and then I can direct people to this more recent playlist to learn the basics first of all okay there so first things first what is node j/s well as
Developers when we’re creating websites we normally talk about code on either the front end inside browser or back end code or server-side code which is the code which runs on a server now javascript is normally confined to run in a browser in the past on the front
End and we’d use it to do things like add interactivity to a web page like click events or things like that now we never used to be able to run JavaScript directly on a computer or server but node allows us to run JavaScript on the server side as well or even directly on
Computers now before you explain any more about that first of all I want to talk a little bit about how computers actually understand code so computers really only understand machine code but that is really complex to write and a read it’s like binary like this so something
Called assembly language is built on top of that which is a bit easier to read and write which is then assembled down into machine code so the computer can still understand it but this right here this assembler language is still overly complex to read and write so built on
Top of that we have programming languages like C++ which are abstracted a lot away from assembly code and they’re much easier to read and write so ultimately this C++ code is then compiled down to machine code so therefore we can write C++ code on a computer and a computer will understand
It because it’s being compiled down to machine code now javascript is a language which is abstracted even more away from machine code than C++ to make programming easier still but computers cannot directly understand JavaScript or compile it down to machine code so we cannot directly run JavaScript on a computer right but
It can run inside a browser so how does that work well running inside browsers is an engine called the v8 engine and the v8 engine is written in C++ by Google and it compiles JavaScript into machine code at runtime so bypassing JavaScript code through this v8 engine
In the browser the computer can then understand JavaScript within the context of that browser however it cannot run JavaScript outside the browser because there is no v8 engine compiling it down outside the browser it’s confined to the browser only but that is where node comes into play so node.js is a program
Also written in C++ and that wraps the v8 engine so this v8 engine that’s in browsers also lives inside node as well now because node is written in C++ it can run directly on our computer so by installing and running node on our computer it can take our JavaScript it
Can run it through the v8 compiler that it has inside it and it compiles our JavaScript into machine code so that in essence we can now run JavaScript directly on a computer or server and not just in a browser but node is more than just a wrapper for the v8 engine
It also hooks into the v8 engines and more functionality to JavaScript so that when we are using nodes a compile and run JavaScript we can use all of this extra functionality in our JavaScript code and that kind of functionality includes things like the ability to read
And write files on a computer or to connect to a database the ability to act as a server for content these are all the kind of things you’d expect a server-side language to do and now we can do them with JavaScript running through node now remember javascript was originally made for the brow
To add interactivity and not to run directly on computers or service so normally it can’t do all of this stuff but with the help of node it can but on the flip side since we’re now using node to run JavaScript outside the browser we lose access to JavaScript features such
As the document object model we can’t interact with HTML elements anymore but we don’t really need to do that when we’re running JavaScript on a server and acting as a back-end to our website right so just going back to computers and machine code node now plugs into the
Top of this stack with the v8 engine so that now we can write JavaScript code on a computer which is then compiled down into machine code forests so that computers can now understand JavaScript and that is freaking awesome so then now we’ve got a bird’s-eye view
Of what node actually does for us what would we actually use it for well the role of node in a website is basically to run JavaScript on the back end or server side and then we’re going to be handling requests coming in from a browser so for example a user might
Visit your website in a browser now that browser is going to make a request to the server the node server is going to run some kind of JavaScript you’ll react to the request and it might communicate maybe with a database or files on the server then it’s going to formulate some
Kind of response and send it right back to the browser now that response could be an HTML page with dynamic data embedded inside it or maybe some CSS and image files etc so basically the note server is running JavaScript on the back end to do all of this so using node in a
Website is pretty much an alternative now to or the server-side languages like Python Ruby PHP etc but the rad benefits of using node over the others first of all if you’re already familiar with JavaScript then there’s absolutely no need to learn a new server-side language because node is going to be taking
Javascript and compiling it down so we can use the same language on the front end and the back end and to that end we can also share cold for front end and the back end since they both use JavaScript it’s very popular and it’s got a massive massive community around
It so there’s always help if you need it and there’s also a huge amount of third-party packages and tools to help with web development and we’re going to see some of those as we go through this course I rather than so in this course we’re gonna go from the absolute beginning and
To begin with I’m going to show you how to install node and use it to run JavaScript on your computer or in a server then we’re going to see how to use know to read and write files on your computer we’ll also see how to create a
Server and then make a website using node by listing for and responding to HTTP requests then we’re going to dive right into third party packages in particular Express to create an express up and that is a very very easy way and a very popular way to build node
Websites then we’re going to introduce databases in particular MongoDB which is a no sequel database and we’re going to use that to store data and then create dynamic web pages and to that end as well we will be using template engines ejs in particular to inject dynamic content into our HTML
Templates which we can then send back to the browser finally we’re going to put everything together that we learn to make a node powered website project so this is the little project we’re going to create it’s a very simple blog website where we can list all of the
Current blogs we can click on one to see more information we can also go to add a new blog and I’ll just call this one Mario Party and add in some ninja tips as you do like so and then click on submit and we can see that new blog at
The top over here we can also delete blogs by clicking on this little Delete icon right here and we have an about page as well which every block needs so this is the project we’re going to be creating using node Express and also MongoDB as the database as well
Throughout this series now before we start I want to make one thing crystal clear this is not a beginner Java Script course and you should already know the foundations of the JavaScript language things like functions how asynchronous code works all that kind of just and ideal it you should also know a little
Bit about HTML and CSS too since at the end of the day we are making a website and there will be HTML and CSS involve now I’ve got courses on both of these things on this channel and on udemy I’ve got a modern JavaScript course and also
An HTML and the CSS crash course as well so the links to both of these are going to be a highlight down below a rather than gang so the first step in all this is to install node on your computer now it might be that you already have node installed on your
Computer but you’re just unaware of it so in order to check that open up a terminal I’m going to use command prompt by typing CMD and pressing enter and then in here type node space hyphen V and if you have node installed it should give you back a version number you can
See mine is version 14 point 1.0 now if you don’t get a version number it means you don’t have node installed and you’re gonna have to go ahead and install it likewise you might get a different number a smaller number which means you have an older version of node in which
Case you might want to update as well so in order to do that to install it or update it go to node.js org this link will be down below and then click on this button right here to install the latest version that’s going to download an installer run that when
It’s done and the install wizard will install node on your computer for you it only takes a couple of minutes now once you’ve done that I would suggest closing your terminal opening it up again and typing in node – V just to make sure you get a version number and
It’s installed correctly so now you have node installed on your computer we can use it to run JavaScript directly on our computer and we could even do that directly inside this terminal so to do that I’m gonna type node and then enter and that starts the node process and
Right now we see a blinking cursor and that’s asking us to basically type some JavaScript to run through node so now I could write something like 5 plus 5 press ENTER and we get back 10 that’s valid JavaScript right and we could write any JavaScript code that we want
To write here so I could say var name is equal to Mario and then type name and we get back and Mario so any kind of valid JavaScript we can write inside this terminal but ideally we don’t want to write code in a terminal all the time
It’s going to be really tough to create a website this way so instead we’re going to need a good text editor to work in now I’m going to be using vs code of Visual Studio code which is a great free text editor and you can get it from code dot visual
Studio comm and click on this download button right here for Mac or for Windows but you don’t have to use this you can use your own favorite like sublime or atom if you prefer but at the minute I would recommend this one it’s a really nice text editor so anyway once you have
Your text editor installed open it up and maybe start a new project folder in that text editor I’m actually going to do that from the command line over here so let me exit this process by clicking ctrl C twice and that exits out of the node process then I’m going to navigate
To a folder where I want to create my new project so I’m going to say CD which stands for change directory to dive into a folder called documents that I have on my computer then CD again to go into another folder I created called totes and then right here I’m going to create
A new directory by saying mkdir that stands for make directory and I’m going to call this node – crash – course and then I’m going to see the into that so see the node – crash – course and then I’m going to open up this particular
Directory inside of the S code now to open that up from the command line in vs code I can say code dot and that means open up visual studio code in the current directory alright so press ENTER and that should hopefully open up visual studio code in this project directory we
Can see that right here in node crash course ok so then now we have our text editor open let’s just give this a whirl what I’m gonna do is create a new file over here and I’m gonna call this test dot J s and inside you I’m just gonna write some
Basic JavaScript code so I’m going to say Const and then we’ll say name is equal to Mario right and all I’m gonna do is console dot log name so I’ve got a JavaScript file now on my computer how do I run this JavaScript file well I can
Do that through the terminal so I’m going to go to terminal at the top and then go to new terminal and make sure you’re in the correct directory where the file exists where you made that file and then type node and then the file name so in our case test now you don’t
Need to add the JavaScript extension because it knows we’re going to run a JavaScript file so I can just say node test which is the name of the file press ENTER and it runs that file for us on our computer and we actually see down here in the terminal which is acting as
The console for us this name Mario okay so it run the file it logged this to the terminal or the console down here so let me try this again I’m going to change this to something else like not your paw but Yoshi and save that now I have
To run this file again for it to work so down here I can just press up to do the latest command I wrote and press ENTER again node test and now we can see Yoshi right here so we could write any JavaScript inside this file then run it
And if we’re logging things to the console we’re gonna see them down here inside the terminal and that’s how easy it is to run a javascript file on our computer using node this is not being run inside a browser anywhere now it’s being run directly on our computer now
Finally going i’ve created course files for every single lesson in this tutorial series and they’re all found on this give repo right here node crash course now don’t worry if you don’t know how to use git or github or anything like that you don’t really need to know how to to
See the code or down load the code I’ll leave this link down below but essentially each lesson in this series is going to have its own branch in this github repo so we can see the branches right here and if you want to see the code for lesson 4 for example
You could go to the lesson for branch and you’re gonna see all of the code right here and all of the different files now if you want to download this you can go to close or download if you’re familiar with github and get you can clone the repo to your local machine
Or if you want to download a zip file with all of this code in you can do by clicking download zip or right here
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
thank you for uploading such content for free. thank you!
cool video)
Pleas you become a muslim
Awesome tutorial! Thank you so much! 💛
Nice
Such a beautiful introduction. Thank you
Just finished course. It's great and still relevant in 2023!
God bless you sir, you are doing the amazing job, please i am a beginner for nodejs and i need a mentor
Just wondering if this playlist is still suited for 2023? thanks!
Nice ❤❤🎉🎉🎉
My man, God gave you the talent to teach and design. Great job, thank you so much.
i really learnt a lot from you Mr. ninja from your videos at no cost!!, i really appreciate, only pray God adds more years,blessings
Amazing video, thank you so much for sharing your knowledge!
is in 2023 worth it study with this course ? i want to start but i wonder
Thank you brother
I am learning android development and want learn backend for android app using nodeJs so. Is this course useful for backend of android app???
is this still relevant??
Great tutorial mate. Do you only have the 3 courses on Udemy? I am looking for an in-depth NodeJS course on Udemy, was hoping you had one.
Is this course still relevant?
Is this material still accurate/close to, for 2023?
Thanks a lot
this is a fantastic series – thank you for developing them
Thanks for awesome videos! I'm a college student and your courses are so easy to follow and understand, it helped me a lot.
I came from horrible teacher with horrible course Maximillan. And when I have found this course.. I litterary started to cry. Thank you so much for hardworking!!
hats off!!!!!!!!!!!!!!!!
thank god for net ninja, Shaun's teaching style if frickin perfect, not a slow trudge from the basics but not too jumpy either
Where is the code of this blog website?
thanks for the course : )
Hello! This video tutorial was two years ago, and I'm wondering if I should watch this crash course or find a recent Node.js tutorial? No, maybe I'll watch it all. I'm just curious. I'm a newbie, Thanks!
Watching your video for the first time. 5 mins in and subscribed! If all the content are this I’ll be bing watching
I LOVE YOU