📜  从 Node.js 中的模块导出函数的语法是什么 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:59.833000             🧑  作者: Mango

代码示例1
function foo() {}
function bar() {}

// To export above functions:
module.exports = foo;
module.exports = bar;

// And in the file you want to use these functions,
// import them like this:
const foo = require('./module/path');
const bar = require('./module/path');