When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.
Read Node.js, Require and Exports and Organize Your Code with RequireJS
- In the context of Node, what is a
module
? - The code examples from the second blog post look very different from the first. Why?
In Node, a module is a nugget of your application that has a very specific purpose. It furthers the single responsibility principle and helps keep functionality separated into its pieces. The second article is all about how requiring specific .js files works and how the application as a whole talks to itself. Rather than only requiring the filename (like we did in Ruby for Mod 1), specific methods are called as well as specific functions, etc.