Transcript from the "Executing Node" Lesson
>> Scott Moss: So let's do a little bit of digging around with Node. So, I just showed you how to run Node in the context of a your terminal. But you can also run Node against a file. So, I mean, who wants to write Node in here? Nobody wants to do that.
>> Scott Moss: So if we had a file, I was gonna call it test.js. And I do some, I'll just do a console.log here.
>> Scott Moss: To execute this file, all I have to do is go into the terminal, type in Node, and then the path to that file, which is test.
[00:00:50] I don't have to put test.js. I can just put test and it'll execute it. So there it is, the console.log, hey. It executed it, and then it exited it. All right? So, it's not running continuously. All right. So, anything that I do in here, it'll work. So, as you can see, the console just prints out to the terminal.
>> Scott Moss: Any questions on that?
>> Speaker 2: Can you make the text bigger, they're asking?
>> Scott Moss: Here, or the, here?
>> Speaker 2: In your editor. They're asking-
>> Scott Moss: My editor. Sorry. Yeah, I must have minimized it last night. Yeah. There we go.
>> Speaker 2: Did you get the question on the, he's seen some people use exports=module.exports.
>> Scott Moss: Yeah.
>> Speaker 2: What does that mean?
>> Scott Moss: Yeah,so, that's like a way to safeguard yourself from not doing a module.exports and then doing a exports somewhere else in the file.
[00:01:57] So by doing exports equals module.exports. That's, I'm just gonna keep everything safe. So I'm still only gonna be able to export one thing, and then I'm guaranteed that some time in the future I don't come down here and say exports.other equals a value. And then, that will never get exported because we had a module.exports.
[00:02:24] So it's just a way of keeping yourself safe. You don't have to do it. But there are a lot of patterns as far as exporting. I'll show you some of the other patterns. But that's a pretty standard pattern. You see that a lot.
>> Scott Moss: But it's just a way of making sure you don't try to export something later after you module.export.
[00:02:46] And not have it be able to be required in another file and have some unexpected side effects.