Skip to content

Instantly share code, notes, and snippets.

@jillmd501
Forked from rrgayhart/require.markdown
Created February 8, 2016 23:38
Show Gist options
  • Save jillmd501/d73747d658c4b96c5599 to your computer and use it in GitHub Desktop.
Save jillmd501/d73747d658c4b96c5599 to your computer and use it in GitHub Desktop.
The Concept of Require

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

Fork this gist and answer the following questions:

  • In the context of Node, what is a module?
  • The code examples from the second blog post look very different from the first. Why?
@jillmd501
Copy link
Author

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.

@rrgayhart
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment