- In the context of Node, what is a
module
?- A chunk of code that can be shared (required) between files, much like classes and modules can be shared between files in Ruby. There is no syntax required when creating what may become a module. Instead, use of
module.exports
at the end of a file determines what code is available when usingvar access = require('path/to/file')
in another file that may need it.
- A chunk of code that can be shared (required) between files, much like classes and modules can be shared between files in Ruby. There is no syntax required when creating what may become a module. Instead, use of
- The code examples from the second blog post look very different from the first. Why?
- The first is using the syntax from node to export modules, whereas the second is using a file and module loader called RequireJS.
Forked from anonymous/the-concept-of-require.markdown
Last active
October 16, 2016 03:06
-
-
Save ryanflach/f24dbec4d52098fd7af7ada2907726ff to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment