&nbps;Home ✈️ Travel ⚾ Baseball 🛠 Tech 📘 Language 👨🏻 Politics About Y Generation  😈
/ tech-note

What is `module.exports` in node.js?

According to the answer over Stack Overflow:

module.exports is the object that's actually returned as the result of a require call.

Also, the exports variable is available on which you can add whatever variables you want to export, such as:

var thunderbolt = function() { ... };
exports.thunderbolt = thunderbolt;

, which is accessable from the exported environment:

var pikachu = require("pikachu");
pikachu.thunderbolt();
What is `module.exports` in node.js?
Share this