Module BasicsLesson 14Free preview
Node Modules
This lesson is part of Node.js · All levels
Summary
Node.js breaks down the code into small reusable modules. A module is a JavaScript file that exports a function, object, or value via module.exports. With this pattern, projects become more organized and easier to test because each responsibility is on its own file.
Key points
- Modules are JS files that export API via module.exports
- Local modules are loaded with require('./path/file') and external packets with require('nama')
- The node caches the module so it doesn't reload repeatedly
- The node provides built-in modules such as fs, path, http, and os
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.