Transcript from the "Intro to Require in Node" Lesson
[00:00:22] If you've seen the closure Hard Parts, it uses that in a really cool way. We may not have time, if not, we'll do it in Hard Parts Node Part Two.
>> Will Sentance: Invite me back, [COUGH], anyway, so we have to tell Node we wanna have access to each of its C++ features independently.
[00:00:44] That's by design. We do that so that we don't bring in access points to all of these features all at once. Because what if I want to go to a mail server, M-A-I-L? A mail server that wants to receive or send out emails? That would not need HTTP as its core protocol.
[00:01:26] It's actually available in this really cool way that's related to how the common JS pattern works, which is where require comes from. But for now, let's just think it was built-in, when you run require, anywhere in an Node file you have require available, whatever you pass to it, it's gonna look at that and go, you want access to the HTTP features.
[00:01:44] Let me give you all of the, and an insert, that's what it actually does. It's gonna say, require's gonna put, in your memory, label HTTP that will be for an object full of functions, which include createServer, exactly, createServer,
>> Will Sentance: And that function is the one that actually sets up the background.
[00:02:25] It's there already. HTTP and all the other ones, to kick off Node C++ features, we have to tell it by using require, bringing those in.