Introduction to Node.js What is Node.js
This course has been updated! We now recommend you take the Introduction to Node.js, v2 course.
Transcript from the "What is Node.js" Lesson
>> Speaker 1: So what is Nodejs? Someone give me your definition of what is Nodejs. Scott Fox, you knew I was going to pick on you. [LAUGH] Like how could I not? Dude I like saying your name. Scott Fox, it's like a comic book character, it's awesome. What do you think Nodejs is there's no wrong answer.
>> Speaker 3: Port of the Chrome V8 engine to desktop.
>> Speaker 1: Yeah, that's also true. He said it's a port, Victor said it's a port of Chrome's V8 engine to desktop, yeah. Anything else?
>> Speaker 4: Dependency manager?
>> Speaker 1: Nodejs does have a dependency manager, yes.
[00:00:45] So that is also true.
>> Speaker 1: That is very true, it sounds like something narrow for yeah, [LAUGH]. That is very true yeah, all that is true. The point that I was trying to make it's like and it's like, what?
[00:01:02] It's like, it's this environment? It's this runtime? It's also a language, it's a server, what is it? It's all those things, okay. So on my slides, you'll see at the top of every slide, I'll put a TLDR about what this slide is, it's meant to be very small like that, but that's what this slide is gonna be.
[00:01:42] Because there was a lot of drama in the past, and if anyone wants to hear about that, I can talk about it later. But they have a foundation. There's a lot of people helping it. A lot of big companies contributing to it. It is open source and when I say runtime, I'm thinking of an executable, right.
[00:03:37] So he took that and he's like actually there's this pretty cool stuff and I wanna do and boom the kind of just blew up Ryan Dhal currently works at, Google right now I believe on some machine-learning stuff. I wonder, did I spell his name right? Maybe it's D-A-H-L.
[00:03:53] But, Ryan Dhal he's got a lot of good talks about node and stuff. So I would check out some of those talks. Really smart guy. Since it was created it has evolved. Like I said, it kind of started off as just this basic thing where it's like yeah, it's not really gonna be serious.
[00:04:12] But now, like you can pretty much do everything in Node, and I would say there is a lot of things that contributed to that. But I would say some of the biggest things are the fact that it has a really big thriving community, probably one of the biggest communities In the open-source world, it comes from Node.
[00:04:27] Most of the stuff that happens first, happens in Node from my experience. If it's gonna happen anywhere, it happens here. And a lot of runtimes and languages and frameworks and stuff kind of look at what Node is doing and try to build something similar. And then all these huge companies like Facebook and Google, they are constantly building tools and frameworks around Node because they know that there's so many developers there.
[00:05:22] So yeah, it's pretty pretty awesome. Any questions on Nodejs. Yes.
>> Speaker 2: From your perspective. How does it compare to other back-end environments like you mentioned you started in Ruby and kind of moved over.
[00:06:17] And we'll notice that with their package manager and the community around that like I can go on Google, like I see the point now I, if I need to do something node I don't even think about making it, I know this is somewhere, somebody made this. And I just go look, and most of the time I'll find it, 90% of the time it's there.
[00:06:33] Even if it's outdated, I can just look at how they did it and kind of do my own thing, but that right there has just been invaluable to help me build things faster and grow faster and actually learn. Because I remember thinking, when I was using Ruby and Python I almost never looked at people's source code to understand what they were doing.
[00:06:50] Whereas in node I look at source code all day. I would just go look at framework source code to figure out algorithms. I just go look at all this stuff to understand what's going on because it wants you to. That's what the community wants. So I would say it's a lot better than that.
[00:07:32] It's just one thing together. And that to me is just amazing. So once you get all the flow and everything going in my experience it's just way better than everything else. Not even close.
>> Speaker 1: Any other questions? Yeah.
>> Speaker 2: It sounds like Ruby. I did Ruby on rails, and I did a multi tenant database with apartment, I don't know if you've ever played with that.
[00:07:54] Is there anything similar to that in Nodejs?
>> Speaker 1: So Nodejs is not a conventions-based platform, so Nodejs has no idea what database you're gonna use, or it doesn't hook into your database and it doesn't provide any tools for your database. So that would have to be up to the database that you choose that does that.
[00:08:11] So if you wanna do some type of multitenancy, then yeah, you would have to figure that out, because Nodejs it's like, it's definitely not a convention based thing. Where as Ruby's like the full package, they got every single thing. Yeah, Node is not like that, Node is just like, here's an environment, here's some globals, good luck, right.
[00:08:30] [LAUGH] That's no, so yeah, there are not conventions like in Ruby. So you are used to that, you're not gonna get it. But the beauty of it is, that the community has built things like that. So although Nodejs doesn't come shipped with something like that, the community is like whoa.
[00:08:44] I used to have this in Ruby so I made it. They have the concept of scaffolding and templating and all this other stuff. So most of the time there's something there, and if not, it's pretty simple to make itself. So that's the beauty of it. You got one?
>> Speaker 4: So according to a lot of Reddit comments, they say Nodejs is not suitable for the data intensive applications. And you might just choose Python or even php.
>> Speaker 1: Yap.
>> Speaker 4: Is that still the case?
>> Speaker 1: Yeah, so we're gonna dive a lot into that later, and in one of the exercises you'll do, you'll encounter that.
[00:09:22] But the short answer is, that is true. Yeah, a node is not I would not recommend it. Even the creators of Nodejs, they put out a blog post not too long ago that was like- Don't use it for this! It's really not meant for high CPU intense operations.
[00:10:00] So because of that, it enables Node to be high on concurrency. But not that efficient on like high CPU bound task. So there's things you got to do to get around that but sometimes you can't get around and you have to use something like Python like if I was doing like some type of machine learning I probably wouldn't do it in note, but I would have no be my API.
[00:10:20] And then have it talk to my machine learning thing over here in Python or something like that. So yeah, it's definitely not the silver bullet for everything. But for most of what people do on the web you can get away with using Node.
>> Speaker 1: Any other questions?
>> Speaker 2: I'd just comment that it's gonna evolve.
[00:10:41] And if people want that, eventually it will happen.
>> Speaker 1: That's true, yeah, so again it's open source, there's nothing stopping anybody from doing and trust me, I've seen some crazy stuff out there that people are making that you can take advantage of. You can even, I mean and there's models inside of Node.js where you can enable Node to take advantage of all the cores inside of a computer.
[00:11:01] You can cluster it, that's what they call it. So there's definitely things you can do So it really is up to you but by default, no, it's not for that. But you know, you can throw money at any problem it'll fix itself. So, you know, if you want to scale something scale it, you know, so it's up to you.