Full Stack for Front-End Engineers, v2 Node.js Configuration
This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v3 course.
Transcript from the "Node.js Configuration" Lesson
>> Jem Young: All right, so that that's fine and nginx, like I said, it's a web server. So we can serve static HTML pages and all that. But at some point, we wanna create complex applications. Applications that have different paths, different ways of maybe connect to a databas. Just coding, kind of more akin to what we do in our day to day.
[00:00:19] To do that, we're gonna create an application server. And that's different from a web server. And the web server's just receiving a lot of web traffic and doing something with it. The application is doing all the heavy lifting. For our application today we're gonna use NodeJS. My website is built in Python using Flask, but I won't go that route today.
>> Jem Young: What is NodeJS though?
>> Jem Young: I'll take that, yeah, yeah, that's right.
>> Speaker 2: Yeah, that but it's also a binding for the V8 engine that Google developed for Chrome.
>> Jem Young: Yes.
>> Speaker 2: It's one of the most performant just-in-time LLVM compilers out there.
[00:02:29] And that means every other request that comes in is gonna get blocked, waiting for the other requests to resolve versus running a node. Node is asynchronous, it says, hey, I wanna get this image. I'm gonna go get this image, in the meantime, I'm gonna go handle all these other requests.
[00:02:43] And that's what's known as the event loop, is just constantly running over and saying like, is there anything to do? Is there anything to do? That's a really powerful concept, you probably won't appreciate it to switch languages. And you're you're dealing with blocking requests, you have to handle request keys and things like that.
[00:02:56] Whereas Node just handles that seamlessly. That's why Node is usually my go-to when it comes to creating a web server cuz it just handles things really well. Is it the fastest? No, Java is generally gonna be faster or Go or Rust. Or many other languages, it's not the fastest languages.
[00:03:12] But if anybody wants to nerd debate you, which people do, just be, Node does what I need. And most of the time you're not gonna be limited by the speed of the engine that is running. It's gonna be something else, like the code you wrote. You will at some point gonna hear a debate about what's better, especially, if you get to talking to C developers and things like that.
[00:03:34] Sorry, that was a tangent, let's install Node. [LAUGH] We're gonna install NodeJS along with npm. So sudo apt install nodejs npm, so install both of them at the same time.
>> Jem Young: So I'm gonna go ahead and do that, sudo apt.
>> Jem Young: Yes.
>> Jem Young: If you're wondering why I said NodeJS and not Node, Node originally was a radio application for Linux.
[00:04:12] For the longest time, if you installed Node it would install this application. But people got really annoyed at it because they're, who uses this versus the number of people that use Node? So now it's just NodeJS and it's gonna take over, if I type in Node, it's gonna use that.
[00:05:01] It's usually installed by default, but this is future-proofing ourselves. So oops, forgot the sudo, sudo apt install git. And it's usually installed already, but just in case, we'll make sure Git is installed.
>> Jem Young: So just apt install git for our version in control.