What is Node.js Exactly? - a beginners introduction to Nodejs
Skills:
JavaScript Fundamentals60%
Key Takeaways
Introduces Node.js to beginners, explaining its purpose and use cases
Full Transcript
hey there so I've got a lot of node.js videos coming up uh I've already recorded some videos on how to do deployments with node.js automated deployments fun stuff but first I wanted to answer the question uh with an introductory video of what is node.js I've had a lot of people ask me this people are saying stuff like hey I've been doing PHP for a lot of years uh but I don't exactly get what node.js is sounds confusing seems like it means a lot of different things and it kind of does to some people so we're going to answer that uh the simple question is or the simple answer is is the makers of node.js took JavaScript which is normally confined to a browser and they allowed it to run on your computer so normally you know JavaScript runs in the browser it can only access your web page uh but when you allow it to run when you give it a an environment to run on the machine they took Google Chrome's V8 engine which is an awesome JavaScript engine and now V8 runs on your machine and so this whole new world opens up now you can access the files on your computer which you normally can't do with JavaScript you can listen to Network traffic on your computer you can listen to http requests your machine gets and send back a file you can access databases directly all sorts of great stuff basically anything you could do with PHP or Ruby on Rails you can now do with JavaScript in node.js and so there's basically two categories of what people are doing with node they're building utilities on the machine which is like utilities for your day in day out development that would be gulp grunt yman you know uh you know things that you'll concatenate and build JavaScript files with or it'll listen to file system changes and it'll do live reload or you know whenever you save a SAS file it will automatically convert a CSS file utilities on your machine if you say a job description if you see a job description that says you know front end developer no js's in there somewhere they probably referring to this kind of node.js if you see a job description that says node.js engineer node.js developer they're probably talking to the other use case which is let's build a web server a web application with node instead of using Ruby on Rails PHP python we're going to use Express framework for node.js or COA framework for nodejs or whatever and we're going to build our web application in this and so that's kind of what the other use case is so so let's do some super Basics on how this node.js thing works well for one if you go to nodejs.org you can install it on your machine then you can type node DV there you go I've got a version I can actually just type node right now and now I'm running a process a process you know kind of a program that's running on your computer I've now created a new process I can type JavaScript ver a equals 1 and type A A equals 1 just like I would normally do on a console but what's different about this is this process right here runs within window so if I go ver a equals 1 then window. a equals 1 because window is my Global scope there is no window object on a node.js process because there's no window uh what there is is a global object Global a equals 1 and then there's also no document object uh JavaScript has a global document object which is my HTML document that this thing's built upon well this isn't tied to an HTML document it's tied to a process uh which is the actual program process that's running right now so I have a process object and that's kind of two differences I'm going to control C twice to get out of that uh and you can also I have my module 1js right here you can also run node module one um and I don't have to put JS but I can and so it runs this and exits cuz nothing's happening so I can go console log High and then I can run that again hi now you can do ver a equals 1 console log a and then run that again says hi it says one so that's kind of how you'll actually execute files just like you would execute PHP files or something like that on your machine and how they let's get into modules real quick um how modules work within node because this is going to apply either way and I'm probably I'm pretty much only going to get into two modules npm and a basic web server and then we're done and that's kind of going to give you the overall scope of how you program in node.js so modules are how you basically load one file into another if you've used required JS you already get the concept let's go there to uh M2 equals require module 2 so that's saying before I do any more code I need to load in module 2 so here's my module 2 I actually have to do this which means I'm looking for a file in the same directory or I could go uh you know if there was other folders going on here I could go folder 2/m module 2 it basically assumes JS is added just like you know if you were running a file over here so in this case it's in the same directory I'm just going to require. module 2 and let's console log this M2 run it and module 2 is a function let's delete that that's from earlier stuff that I was testing the video module 2 is an empty object because module 2 is not exporting anything at all I can go ver a equals 1 run it still nothing I've defined ver a in here but I'm not exporting that to get this from module 2 into module one it's whatever is exporting from module 2 is what will get passed into this M2 variable so if I go module exports a equal a so now I'm assigning a to module exports a there you go now the value of a is one I can go module exports b equals 2 and now you see I'm just basically building a whole object uh you can also shorthand this you can just go exports exports a equals that same thing works just fine or you can override the entire module exports object and make it a function so module two so now I can actually go M2 equals require module 2 and I can run M2 because it's a function now so there you go when I run function module 2 it's going to console log it so that's kind of how modules work uh that's kind of how your separation of files Works in node.js and what they've also built is this node package manager which is npm it comes with with node and that allows you to actually download um and manage packages which is really cool so I can go npm install underscore it's pretty popular module so now it made a node modules folder and it added underscore in there and so now I can actually go there equals require underscore no no file path no Dot SL just underscore and so that's going to look in my node modules folder for the underscore module and the underscore package will tell me what file that loads and that is by default just going to load underscore so now I can go uh C console log my underscore character and when I run module one you see that's the whole under _ Library awesome super cool so npm is a super easy way of installing common things um and then the other piece to npm is ideally you want to save them in a package if you're working on a project and you have 15 different node modules you don't want to have you don't want to have to run npm install every time somebody downloads your you know GitHub repository and needs these dependencies you want to be able to save the many dependencies you have so you'll actually run npm and nit and we're actually going to start an npm package here real quick name what is node sure sure sure sure sure sure sure um and so I just said okay to everything and it made a package Json file for me and so it's called what is node has a version blah blah blah and you see it already added underscore as a dependency for me because I've already installed that so now I can do npm install backbone if I run npm install backbone it added to my node modules as well but it did not add to my package Json because I didn't do the flash s or slash dash s flag so now if i do- s that's for save you can see that it now added Backbone in here into my package Json as well um and so now I've got the two going on let's say I delete this node modules folder Al together bye-bye go away you don't want to keep the node modules in so now my my whole node project consists of this one package Json file and all I have to do is go npm install npm install is going to look through all the dependencies and it's going to get them all there you go now I've got all my node modules and now everything's going to work I can require UND underscore again so that's kind of if that made sense that's how npm Works npm allows you to maintain all your dependencies one of the awesome things about node is there's thousands and thousands of dependencies that people are building all the time that allow you to do cool things like uh you know access web services or log into Google with your Google email address there's packages out there for all this stuff so in node you can just load in a package real time the package will do the dirty work for you and you can focus on building your application let's look at the HTTP package which is what we use to make a basic web server we don't have to install this with npm because it comes built into node HTTP and we can go HTTP create server and let's give that a function whoops and we'll go ver server equals that returns a server and that server can listen to Port 3002 normally run node stuff on Port 3000 actually so we'll do Port 3000 makes this a little bigger here so now I'm going to create a web server and that web server will get request response and so whenever I get an incoming request on Port 3000 this function will fire and I get to access what they're requesting and I get to actually make a little response so I'm going to do is I'm going to console log got a request and I'm going to do response dot WR hi and I'm going to response.end there we go and now let's run this so you notice it runs and it keeps running it doesn't stop because there is an open server running that's listening to any request on Port 3000 so if I go to Port 3000 it says hi and it says hey I got a request let's do it again nice got another request it's sent back high if I keep doing this it's going to keep saying hey I got a request I got a request let's send high back every time super cool it's super awesome and so that's kind of how you build a basic web server um you could listen to if I went Local Host 3000 slash give me a file then it's still just going to say hey because there's no smart code in here listening to what the path is and what we're going to do with that path and so but we could listen to the path and if the path is image. jpeg we could go get image. JPEG and respond back with that so that's kind of what node.js is from here on out you get to mess around with it if you want to learn how to build an Express web app then I have a video on that already I'm going to put that video the description and that's an introduction to nodejs
Original Description
What exactly is node.js? Is it a command-line tool, a language, the same thing as Ruby on Rails, a cure for cancer?
If you're new to web development, it can be a bit confusing as to what exactly node.js is and to what you should do with it, and there's a lot of information out there...most of which seems to be tailored towards genius-level developers.
So, here's a node.js introduction for those who have no idea what it is.
We're going to cover the difference between javascript in a browser vs javascript in node.js and the common uses for node.js.
To wrap it up, we're going to spin up a quick web server in node.js just to show you how easy it is.
Now, learn how to build an Express.js App!
https://www.youtube.com/watch?v=FqMIyTH9wSg
-~-~~-~~~-~~-~-
Also watch: "Responsive Design Tutorial - Tips for making web sites look great on any device"
https://www.youtube.com/watch?v=fgOO9YUFlGI
-~-~~-~~~-~~-~-
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from LearnCode.academy · LearnCode.academy · 53 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
▶
54
55
56
57
58
59
60
Web Development Tutorial for Beginners (#1) - How to build webpages with HTML, CSS, Javascript
LearnCode.academy
Web Development Tutorial for Beginners (#2) - Basic CSS - How to build a website with HTML & CSS
LearnCode.academy
How to create CSS Layouts - Web Development Tutorial for Beginners (#3) - with HTML & CSS
LearnCode.academy
Bootstrap Tutorial For Beginners - Responsive Design with Bootstrap 3 - Responsive HTML, CSS
LearnCode.academy
Angularjs Tutorial for Beginners - learn Angular.js using UI-Router
LearnCode.academy
CSS Tutorial - Web Development Tutorial for Beginners (#5)
LearnCode.academy
Node.js tutorial for beginners - an introduction to Node.js with Express.js
LearnCode.academy
Github Tutorial For Beginners - Github Basics for Mac or Windows & Source Control Basics
LearnCode.academy
Javascript Tutorial - Programming Tutorial for Beginners Pt 1
LearnCode.academy
Javascript Tutorial - jQuery Tutorial for Beginners Pt 2
LearnCode.academy
AngularJS Directives Tutorial - Part 1 - Demystifying Angular Directives
LearnCode.academy
WATCH THIS IF YOU WANT TO BECOME A WEB DEVELOPER! - Web Development Career advice
LearnCode.academy
YEOMAN TUTORIAL - Master Front-End Workflow with Yeoman, Grunt and Bower
LearnCode.academy
BOWER! - Streamline Web Workflow with Bower Package Manager
LearnCode.academy
Chrome DevTools for CSS - Better CSS Coding & CSS Debugging with Developer Tools
LearnCode.academy
GITHUB ATOM - Why Atom.io will be your favorite Text Editor!
LearnCode.academy
GITHUB PULL REQUEST, Branching, Merging & Team Workflow
LearnCode.academy
Pimp that Terminal - Add shortcuts and functions to your .bash_profile to simplify routine tasks
LearnCode.academy
jQuery Tutorial #3 - Writing Smarter, Better Code - jQuery Tutorial for Beginners
LearnCode.academy
jQuery Tutorial #2 - Event Binding - jQuery Tutorial for Beginners
LearnCode.academy
jQuery Tutorial #1 - jQuery Tutorial for Beginners
LearnCode.academy
Node.js MongoDB Tutorial using Mongoose
LearnCode.academy
Node.js tutorial for beginners 2014 - an introduction to Node.js with Express.js
LearnCode.academy
WEB DEVELOPMENT - SECRETS TO STARTING A CAREER in the Web Development Industry
LearnCode.academy
jQuery Tutorial #4 - DOM Traversal with jQuery
LearnCode.academy
jQuery Tutorial #5 - Building a jQuery Tab Panel Widget
LearnCode.academy
jQuery Tutorial #6 - Building a jQuery Image Slider
LearnCode.academy
jQuery Ajax Tutorial #1 - Using AJAX & API's (jQuery Tutorial #7)
LearnCode.academy
jQuery Ajax Tutorial #2 - Posting data to backend (jQuery tutorial #8)
LearnCode.academy
jQuery Ajax Tutorial #3 - Delegating Events & Mustache.js Templating (jQuery tutorial #9)
LearnCode.academy
jQuery Ajax Tutorial #4 - "Edit" modes & Better Mustache.js Templating (jQuery tutorial #9)
LearnCode.academy
How to put your website online - how to FTP to a domain & upload files to a webhost
LearnCode.academy
Basic Terminal Usage - Cheat Sheet to make the command line EASY
LearnCode.academy
SSH Tutorial - Basic server administration with SSH
LearnCode.academy
Vagrant Tutorial - Running a VM For Your Local Development Environment
LearnCode.academy
Sublime Text Favorite Packages and Workflow
LearnCode.academy
What Makes Javascript Weird...and AWESOME - Pt 1
LearnCode.academy
Javascript is Event-Driven - What makes Javascript Weird...and Awesome Pt 2
LearnCode.academy
Javascript Closures Tutorial - What makes Javascript Weird...and Awesome Pt 3
LearnCode.academy
FREE REST API - Practice Developing Javascript AJAX Apps with this API
LearnCode.academy
Javascript Scope Tutorial - What Makes Javascript Weird...and Awesome Pt 4
LearnCode.academy
Javascript Context Tutorial - What makes Javascript Weird...and Awesome Pt5
LearnCode.academy
Nginx Tutorial - Proxy to Express Application, Load Balancer, Static Cache Files
LearnCode.academy
Live Reload Sublime, Chrome, Anything - Fast and easy with Live-Server
LearnCode.academy
Are you bad, good, better or best with Async JS? JS Tutorial: Callbacks, Promises, Generators
LearnCode.academy
Javascript Generators - THEY CHANGE EVERYTHING - ES6 Generators Harmony Generators
LearnCode.academy
Web Development Advice - Interview with Dev Tips
LearnCode.academy
How the Internet Works for Developers - Pt 2 - Servers & Scaling
LearnCode.academy
How the Internet Works for Developers - Pt 1 - Overview & Frontend
LearnCode.academy
HAPROXY vs NGINX - 10,000 requests while killing servers
LearnCode.academy
Node.js Cluster - Boost Node App Performance & Stability with Clustering
LearnCode.academy
Web Dev Training with Treehouse
LearnCode.academy
What is Node.js Exactly? - a beginners introduction to Nodejs
LearnCode.academy
How to deploy node.js applications #1 - spin up a server
LearnCode.academy
Deploying node.js applications #2 - provision server & setup flightplan
LearnCode.academy
Deploying Node.js Applications - Deploy Node the right way - as an Upstart Service
LearnCode.academy
Mobile Web Design - Coding Workflow For Mobile Websites
LearnCode.academy
WHY YOU NEED A BUILD SYSTEM LIKE GRUNT, GULP, BRUNCH FOR YOUR WEBSITE
LearnCode.academy
GRUNT TUTORIAL - Grunt makes your web development better!
LearnCode.academy
STOP USING FTP! - How to Deploy with Flightplan over SSH
LearnCode.academy
More on: JavaScript Fundamentals
View skill →Related Reads
📰
📰
📰
📰
Next.js vs Remix vs SvelteKit: Which Framework Should You Learn?
Dev.to · Etrit Neziri
Had my Frontend Developer interview with Capgemini (Application Developer) today, and I wanted to…
Medium · JavaScript
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · Programming
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · JavaScript
🎓
Tutor Explanation
DeepCamp AI