
Introduction to Node.js, v2 Node.js Intro Q&A
This course has been updated! We now recommend you take the Introduction to Node.js, v3 course.
Transcript from the "Node.js Intro Q&A" Lesson
[00:00:00]
>> The question was Node.js was originally created from Chrome's V8 runtime, and that's what it runs on. But if the Chrome team decides that, hey, we're gonna make something called V9, what's gonna happen to Node? Is Node gonna stay up to date with that new engine that Chrome is doing?
[00:00:17] So there's a whole board, there's a working group of individuals who are responsible for what's coming to Node and what's happening with Node. In fact, there's a lot of history there, a lot of controversial history. At one point the community split off from Node and made this other thing called IO.js and then it came back.
[00:00:37] It's pretty crazy, it's a lot of drama there, but it seems to have settled, it seems to have stabilized, and it seems that they're actually doing really good by getting these versions out. Because for a long time we were on version 0.12 for years, they didn't release version 1 and it took them a long time to do that.
[00:00:54] So anyway, I think what they're gonna do is that they have a process of what makes sense to bring into Node and what doesn't. Because they can't bring everything because a lot of the optimizations that happened in the browser are browser specific optimizations and have nothing to do with Node and vice versa.
[00:01:12] Node has probably a lot of more security issues that they have to work around, the different things like that that don't mean anything to the browser. So I think when it comes to stuff like global JavaScript features that are independent of an environment like modules, or syntax, you can expect those things to come back to Node.js.
[00:01:31] Which is why I wanted us to download version 14 because we do have some of those new syntax features. But when it comes to environment specific features, do not expect those to be able to be used inside of Node.js. The question was, well, what are the differences between version one of this course and version two of this course?
[00:01:49] Version two is gonna be using the absolute latest version of Node. And compare that to the version one of this course, so much has changed from the module, syntax as you'll find out to how you even execute different files and how you test different things. So new tools, new syntax, new execution patterns, and really just, me I've grown as an engineer since I've taught this course last and I have different opinions.
[00:02:15] I have different ways about building things and I want to share those with you all, and hopefully they're valuable to you, so a combination of all of those. The question was what's my opinion on Deno? I feel like Deno has a lot of potential. I do see some of the shortcomings of Node.
[00:02:33] So if you don't know what Deno is, Deno is a new runtime created. So it's a JavaScript runtime or technically it's a TypeScript runtime that's very similar to Node.js. So it's an OS level language like Node.js where you can build things like C allies, and servers, and stuff like that.
[00:02:50] But they do things differently as far as how you import and use packages, how you bundle them. It basically takes some of the best packages that you would have to find, research, and install yourself in Node.js and makes them available by default natively inside of their runtime so you don't have to do that.
[00:03:10] So things like testing, things like bundling, you kind of get that for free. Whereas Node.js as you'll find out, you gotta go shopping for that, you gotta figure out, well, what's the best testing library? What's the best framework? What's the best server thing? Well, Deno kinda figures all that stuff out for you.
[00:03:26] It has a more modern approach about how to build applications. And it's benefiting off of the community and all the patterns that have developed over Node over the last ten years. So it's just like a combination of everything that was great about Node that the community had to make and then let's just put it into this thing and call it Deno.
[00:03:45] So I do think it has a lot of potential. I don't think it's gonna replace Node, Node is everywhere. There's so much stuff built on Node that I find it hard that something's gonna come and replace it, but I do think there's room for Deno. If you're gonna go out there and build something greenfield, something brand new, and you don't wanna go shopping for all this stuff, yeah, Deno could be it.
[00:04:09] The only limitation there is, what's available for you? I would say one of the biggest features of Node.js is the fact that the communities is huge. It's like a double edged sword, it's like, yeah, you got to go find everything, but there's a lot of stuff that you can go through it, it's very helpful.
[00:04:24] So I think if a community can develop around Deno and everything goes well, then there's probably potential, but I would say for now, Node.js isn't going anywhere, but Deno does seem promising. And I've actually used it, and I tried all the time, and I like it. The question was testing in Node.js, where sometimes we have to test browser specific things like the DOM in Node.js.
[00:04:48] And can we do that in Node, and the question is, yes. And I know that sounds confusing because I just said there's no browser specific stuff in Node, and that's still true. But because Node has a thriving community, people have developed mock implementations of the DOM. They have developed virtual implementations of the DOM to where your browser based code knows no difference.
[00:05:11] It's the same to it, so it can be executed. In some cases, it can be rendered if it's like a JavaScript framework on the server. So yes, you are able to run a lot of that stuff on the server and at least the functionality of it. You shouldn't expect to visually see something because that still has to be processed by a browser even if Node is the thing that's sending it to the browser, and processing it, and taking a screenshot or something like that.
[00:05:35] But yes, you still have to go through a browser if you wanna see a visual output. But as far as testing the logic, testing the DOM, things like that, yeah, at the end of the day, the DOM when it's rendered is just a string. So yeah, Node can handle strings, so yes, you can totally test DOM things in Node.js.