Jonas: Hey there, how are you doing today?
So I hope that you've been learning JavaScript like crazy
and finish this course with a deep understanding
of how the language works
and everything we can do with it in a browser.
Now maybe you are aware of the fact
that we can actually also use JavaScript
outside of the browser.
And the most popular way of doing so
is by using a technology called Node.js
which we can use to create web servers
and build the back ends of our web applications.
So in this bonus section I wanna give you
a very brief crash course into Node.js
by building a simple project
using this modern and quite popular technology,
because in fact we will still be using JavaScript,
and so I thought it made perfect sense
to include this topic as a bonus
to The Complete JavaScript Course.
So this is a small project that we're gonna build
with the terrible name, The Laptop Store.
Okay and so we have these five laptops here.
And this page is actually completely generated
on a Node.js web server, okay.
So when you click this button here,
notice how the URL changes from products
to laptop with the ID of zero.
So this laptop here has the ID zero.
We can go back and the Node.js again
generates this page here.
Then when you check out the second one,
this one has the ID number one.
And as you can guess,
this one will have the ID number two,
three and four, okay.
So again all of these are
automatically generated by Node.js,
and so that is exactly
what we're gonna build
throughout this small crash course.
So I hope that sounds and looks
super exciting to you.
And so let's now dive right in
and start by getting a quick idea
of what Node.js actually is.
So the official definition
is that Node.js is a JavaScript runtime
built on the V8 JavaScript engine.
Now that sounds a bit crazy,
so what does it actually mean?
Well, let's start by trying to understand
what a JavaScript runtime and a V8 engine are.
So as I mentioned in the beginning,
if you have used JavaScript before,
it was probably always just outside a browser, right?
Because any browser natively understands
HTML, CSS, and JavaScript.
And no matter if you write
Vanilla JavaScript
or React or Angular,
it's all just JavaScript
that gets executed
right in the browser.
So in this case the browser
is the JavaScript runtime.
But what if we could take
JavaScript out of the browser
and simply execute our code somewhere else
without all the restrictions that we have in the browser?
Well, it turns out that we actually can,
and the solution for this as you can guess by now
is called Node.js.
And so Node.js is just another JavaScript runtime.
It's just like a container, like an environment
in which a program written in JavaScript can be executed,
but outside of any browser whatsoever, alright?
It's actually a bit more complex than that of course,
but for now this is enough.
Now who actually does execute a code,
if not the browser?
And that's where the V8 engine,
developed by Google, comes into play,
because that is exactly where JavaScript code
will be parsed and run in Node.js, okay?
So I hope that the definition of Node.js
being a JavaScript runtime built on the V8 engine
makes a lot more sense to you now.
And again remember that this is just
a very high level overview
of what Node is and how it works,
but in this small crash course,
all I want is to really just give you a quick idea
of what Node is and what amazing things we can do with it.
Anyway now that we have JavaScript outside of the browser
in a kind of standalone environment which is Node.js,
we can do so much more things with JavaScript
that were completely impossible before,
like accessing the file system
or better networking capabilities
are now possible with Node.js.
And all these factors together
give us the perfect conditions
for using Node.js as a web server,
meaning that now we can finally use JavaScript
on the server side of web development
in order to build fast highly scalable network applications
for powering the back end for websites or applications.
Okay and so let's do exactly that in the next video
where we're gonna start building
that project that I showed you.
So I hope you are excited for that
and see you in a second.