A very important part of learning Node consists of learning about modules. This is because the core Node JS comes with just about the minimum stuff required to create a networked application. You could say its aint much when you are about to create a full blown web application, lets say.
This is where modules head in. These are files that extend the core features.
- You can include them on an ad-hoc basis and build apps with it.
- Dividing your code into modules helps keep the code under control.
- Every other concept in Node JS evolved from the availability of this feature, for e.g. connect, express etc
Since these modules are developed by various third parties, including them in a global namespace can prove fatal for the program due to security issues, bugs and conflicts. Therefore Node needed to have a separate context for each module that it loaded.
Third party modules are referenced by file path or names.
.